I’m making a game with DarkRift API, first the player has to create the server, then the host needs to wait for other players in a lobby before starting the game. When a player connects to a server, the active scene for that player changes with SceneManager.LoadScene(1, LoadSceneMode.Single) (I also tried adding SceneManager.SetActiveScene(SceneManager.GetSceneByBuildIndex(1)) after that line).
Here’s the problem, if a player leaves the server, the scene of that player changes to the first one ( SceneManager.LoadScene(1, LoadSceneMode.Single) ), but if he tries to join again to a server, in the moment when he receives all the DarkRiftAPI messages to sync all the stuff, the script needs to change the texts with the info, but it says that the Text has been destroyed.
I putted a Debug.Log of the Texts, and in the moment when all the messages are received, the Texts are null, but after the player stops receiving, the Texts are normal.
Basically, the first time a player joins a server, everything is normal, but if he disconnects and try to connect to other server, that happens.
I tried to change the Script Execution Order but it doesn’t fixed it.
EDIT: I believed when I load the scene again, the variables are the same before the scene unloaded, so in the first call the variables aren’t the new Objects, but if I put a Debug.Log on Start, the object exists, but on any other void, the object is null.