Unity VR UNET让PC和VR成为同一个播放器

Unity VR UNET make PC and VR the same player

抱歉,没有可显示的代码,但这是一个非常架构化的问题。

首先,我不得不说我必须使用 UNET,是的,我知道它已被弃用,但我并不是在做一个让用户加入游戏的实际网络游戏。我会解释: 我有一个连接到硬件的项目。 PC 是 运行 控制硬件并从中接收信息等的 Unity 大脑。这部分效果很好。

问题是我需要连接 Simple VR 眼镜环顾四周(只是为了环顾四周和 "PRESSING" 开始按钮),除此之外,一切仍将由 PC 控制(那将 运行 UNET 服务器(如果需要)和主要客户端移动并获取输入并执行操作,而 VR 需要是一种 "Slave" 类型,只是为了环顾四周。我想要 UNET,因为用于该项目的统一是 18.3.14f1,是的,我知道它很旧,但它是一个遗产,我现在不能改变,我不需要一个可以作为所有硬件的服务器在同一个局域网中。

据我所知,在客户端/服务器中,每个客户端(PC 和 VR)都会生成一个新客户端,因此当 VR 中的客户端与 PC 上的客户端不同时。这让事情变得非常复杂。

我可以拥有某种可以控制两者的 MASTER / SLAVE 东西吗? 如果不是,我应该在服务器上做所有事情并将所有事情发送给两个客户端吗?或者我仍然应该采用常规方法并将所有内容从客户端发送到另一个(更改应用程序中的所有代码)?

找不到答案,我认为这不是一个非常有用的案例场景。

10 倍。

First of all, I have to say that i have to use UNET and yes, I know it is deprecated, but i'm not doing an actual network game that will let users join the game. I will explain: I have a project that is connected to hardware. The PC is running the Unity brain that controls the hardware and receive info from it and so on. This part is working great.

您可以使用 Mirror 这样您就不会 运行 在 Unity 从引擎中删除 UNET 时遇到麻烦。

The thing is that I need to connect Simple VR glasses to look around (JUST FOR LOOKING AROUND AND "PRESSING" the start button) and nothing else, everything will still be controlled by the PC (That will run a UNET server if needed) and the main client that moves and get inputs and do things, And the VR need to be a "Slave" of sort just for looking around.

这不是 UNET 的工作方式。基本思想是游戏 运行 同时在每台设备上运行。您的 VR 眼镜必须 运行 游戏才能渲染它。使用 UNET,您只需同步游戏状态并确保每个连接的实例都具有相同的状态。

From what i can understand, In Client / Server every client (PC AND VR) SPAWNS a new client so when client in the VR will not have the same client that is on the PC. That is making things very complicated.

Can I have some kind of a MASTER / SLAVE thing that will control both? If NOT should I do everything on the server and send everything to both the clients? Or should I still have the regular approach and send every thing from on client to the other (change all the code in the app)?

每个连接的设备都可以在每个连接的游戏实例上生成一个新的玩家。我认为这将帮助您区分客户端之间的 VR 眼镜和同步状态。

Couldn't find an answer for that, I don't think it is a very used case scenario.

您没有被 UNET 锁定。有时设置您自己的 TCP 或 UDP 通信是可行的。

你的UseCase描述不明确。 VR Glass 运行 是否应该独立并且您希望 PC 承担所有工作负载?还是连接 VR 眼镜以创建共享体验? PC的作用是什么?那里应该显示什么?