When Do SyncLists get Initialized?
Hey,
I'm having issues that are only occurring when changing map (e.g. going from one online scene to a different one, retaining all current players). The first time into an online scene everything runs fine. However each time I change online scenes after that about 50% of the time I hit issues where one of my SyncLists (just a SyncListInt) is not initialized when OnServerAddPlayer is called.
I need this to be initialized before I can start adding players. As far as I can tell from the documentation there is no way to check whether or not a SyncList has been initialized, is this correct? If that is the case, can anyone suggest a solution or workaround that might help?
I'm having major issues with UNET call-timings - it seems that they vary wildly between Editor/Standalone and also even during different runs of a standalone build.
For clarity, what's happening in a 3 player game (1 host, 2 clients) is outlined below.
When the host first starts a game:
RequiredNetworked$$anonymous$$anagerObject runs OnStartServer
UNET$$anonymous$$anager runs OnServerAddPlayer for the host.
Client 1 chooses to connect.
UNET$$anonymous$$anager runs OnServerAddPlayer for client 1.
Client 2 chooses to connect.
UNET$$anonymous$$anager runs OnServerAddPlayer for client 2.
When the map changes, however, the following call order happens around 50% of the time:
UNET$$anonymous$$anager runs OnServerAddPlayer for client 2.
SyncList not Initialized errors occur.
UNET$$anonymous$$anager runs OnServerAddPlayer for client 1.
SyncList not Initialized errors occur.
RequiredNetworked$$anonymous$$anagerObject runs OnStartServer.
UNET$$anonymous$$anager runs OnServerAddPlayer for the host.
Host is the only player who successfully manages to connect.
Is there any way to ensure OnStartServer runs BEFORE any players are added?
Your answer
Follow this Question
Related Questions
How to move an object over the network. If only the client controlls/moves that non-player object? 1 Answer
Unity Networking 1 Answer
Network Soccer Ball Position jitter, sending transform position late? 0 Answers
UNET AssetID 0000 zero 0 Answers
PLS recommend plugins for networking/sever which ONLY work for authentication + storing player info. 0 Answers