- Home /
How can I synchronize bullets properly?
Greetings,
I am working on a small space shooting game and I have a question regarding to bullet spawning. Instead of writing a wall of text I can give you a short example to describe my problem.
I am using unity network transform (I've tried increasing the network send rate, the movement interpolation and so on)
The bullets are instantiated on the host, using a [Command] method Problem: When the ship moves, there is a gap between the correct and the actual spawn point of the bullet, which depends on the speed of the ship. On client side the host's ship is correct, so I assume the problem is with synchronizing the object instantiation through network since the transform of the bullets shooted by the host's ship is pretty accurate.
Can someone please tell me how can I get rid of these gap? Thanks :)
If you are using the built in networking system, then I suggest reading into SyncVars, these are the most accurate way to sync information on a network.
Answer by tormentoarmagedoom · Feb 22, 2018 at 08:43 AM
Good day.
As bullets have a predictible movement, they can be initialized in server, give it a velocity, and then just spawn it at the clients.
i recommend you this tutorial, and more specific, this chapter
If helped, accept the answer! :D
Your answer
![](https://koobas.hobune.stream/wayback/20220612153133im_/https://answers.unity.com/themes/thub/images/avi.jpg)