- Home /
Network.Instantiate/Destroy vs Instantiate/Destroy on each client using [Command] and [ClientRpc]
Hello,
In my game I have objects that appear randomly at predefined positions when a player joins a game (from a random seed generated by the server). I currently have a system that allows me to add and destroy these objects: When a player picks the object, I call a method (Command) that calls another (ClientRpc) with the spawn point id (parameter) of the object. I then call another method (in ClientRpc) to destroy this object (locally) on each of the clients.
My question is: Would it be better to use Network.Instantiate and Network.Destroy? Which is the most economical (UNET) or the fastest?
Thank you!
Answer by Bunny83 · May 26, 2018 at 02:45 AM
Network.Instantiate and Network.Destroy are part of the legacy networking system (RakNet) and do not apply to UNet. UNet has an authoritative setup. Networked objects has to be created by the server and spawned by the server. You may want to look through the manual about spawning
Okay, but currently they are not networked objects. They are only instantiated and destroyed at the same time independently on each client. Would it be better to make them that way? That's my question.
Your answer
Follow this Question
Related Questions
[UNET] Optimizing Commands 0 Answers
Getting this error when using Network.Instantiate 0 Answers
Networking | Getting buffered other - previous spawned players 1 Answer
UNET - Conditions 0 Answers
Weird network spawning bug. 1 Answer