Check that the scene passed to AddConnectionToScene is valid #805
Closed
mifozski
started this conversation in
Feature Request
Replies: 1 comment
-
I added this to the method in 4.5.4 if (!scene.isLoaded || !scene.IsValid())
{
NetworkManager.LogError($"Only valid, loaded scenes may be used.");
return;
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
The idea is to check if the scene passed down to AddConnectionToScene is valid. A scene instance can be invalid, i.e. referencing a scene that does not exist. AddConnectionToScene eats it up and doesn't log any errors or messages. This leads to very weird bugs that happen relatively far down the path on the client side, and that are hard to track back to the AddConnectionToScene call.
Background:
I spent about two days trying to understand why the object syncing for a dynamically loaded scene was not working.
It turned out I was calling AddConnectionToScene incorrectly. I was using SceneManager from UnityEngine to retrieve the scene but instead of passing the name I was passing the path, and since SceneManager just silently returned an invalid scene, it took some time to figure this out.
Beta Was this translation helpful? Give feedback.
All reactions