简体   繁体   English

统一网络:客户端生成时,子弹未显示在服务器上

[英]unity networking: bullets not showing on the server when spawned by the client

I am making a simple 2D shooting game. 我正在制作一个简单的2D射击游戏。 Movements currently appear on both sides of the server fine, however bullets only appear on the server if the host creates them. 当前,移动良好地出现在服务器的两侧,但是,项目符号仅在主机创建时才出现在服务器上。 If the client makes bullets, they cannot been seen by the host (but can be seen by the client), so I presume that they are not being spawned on the server. 如果客户端发出子弹,主机将无法看到它们(但客户端可以看到它们),因此我推测它们不会在服务器上生成。 As the host works but the client doesn't, I do not understand why this problem occurs and how it works, so if someone could explain it to me, that would be great... 由于主机有效,而客户端无效,所以我不明白为什么会发生此问题以及它如何工作,因此,如果有人可以向我解释一下,那就太好了...

Looks like it's a case of creating the object on the server, perhaps with a client call that initiates that process. 看起来是在服务器上创建对象的情况,也许是通过启动该过程的客户端调用。 Then, the server will Spawn that object, and send the object to all clients also. 然后,服务器将Spawn该对象,并发送对象到所有客户端也。

See here for a detailed guide: https://docs.unity3d.com/Manual/UNetSpawning.html 请参阅此处以获取详细指南: https : //docs.unity3d.com/Manual/UNetSpawning.html

Most notably, check the "Object Creation Flow" section. 最值得注意的是,检查“对象创建流程”部分。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM