Host create Lobby and Create Relay than start the “StartHost()”
Client join same Lobby, Join same Relay than start “StartClient()”
After these action Host join “Game” scene manually.
After these action Client join “Game” scene automatically.
Bug : When client join the “Game” scene “GameplayManager”'s Awake method trigger after “Dynamic NetworkObject”'s “OnNetworkSpawn” method.
GameplayManager is in the Game scene and “GameplayeManager-Init” log is in the its awake method!
This error occurs when “OnNetworkSpawn” tries to reach an object in GameplayManager.
Why is “OnNetworkSpawn” triggering at two different times in two different scenarios?
AND
How can I handle it this issue?
Edit:
In Scenario 2 => The Host awaits the Client on the Lobby scene and then joins the Game scene with the Client.
Thanks for reply but, I have solved the issue.
The problem is about scene synchronization.
The host was creating the PlayerObject in theAwake method of GameplayManager.
I moved this action to “NetworkManager.Singleton.SceneManager.OnLoadComplete” method than the problem solved!
If you run into a problem like mine, I would recommend looking at the scene manager structure of the GalacticKittens