- Home /
Server 24/7 and NetworkID owner
I want to have server 24/7, and players who login and logout all the time. Users create own objects by Network.Instantiate(). Logout doesnt destroy them. When they login again, write proper user name and password they can take control over their objects again.
There is a problem. When they login again they have another ID Network.Player. I dont know which approach should I take. If I set player his old ID , there will be RPC error sending RPCs to non egzisted "new player". Setting all objects to new onwer is even worse idea.
Why not safe the namee of the player/username by sending it to the server and linking it with the object with a RPC call?
Because Im using the NetworkView, so if the owner changes something it changes as well on the other players maps.
If I would do as You say, I would need to write a lot of different RPC calls.
Answer by Bunny83 · Jun 21, 2012 at 12:48 PM
What ExTheSea said is the only way. Unity's networking system isn't ment for identifying players across sessions. You need your own management to handle such cases. NetworkViewIDs become invalid when the owner left the game. There's no way to "link" them back to a new owner. ViewIDs can't change the owner. So Network.Instantiate is a very bad idea for what you want to do.
When a player reconnects, the server have to recognise the player in some way (username / password ...) and the player have to recreate all ViewIDs of all objects that should belong to him, and you have to synchronise them with the objects on all peers.
Again, you have to ship your own object management and Network.Instantiate doesn't work in this case.
So I should in approach Instate everything by main server? And players can access it by RPC calls?
Hmm, well there will be no errors with finding the owner of gameObject.
Your answer
![](https://koobas.hobune.stream/wayback/20220613073040im_/https://answers.unity.com/themes/thub/images/avi.jpg)