Invoke OnClientLoadedStartScenes for connection scenes if there are no global scenes #510
celojevic
started this conversation in
Feature Request
Replies: 1 comment 1 reply
-
You are wanting to halt the on loaded start scenes if the client currently has a scene load pending? If that's the case, it might be possible. The server knows if clients received load instructions, it's possible if the load scene is sent before the event is dispatched that the event could be put off until receiving a load confirmation from the client for your connection scene. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Currently, SceneManager.OnClientAuthenticated tells a client to have empty start scenes if there are no global scenes available, regardless of whether you are loading a connection scene for them. This would cause clients to call OnClientLoadedStartScenes when they actually haven't loaded their start scene yet. The connection scene loading loop is async, thus gets called far after this method executes.
Maybe you could add a toggle to the SceneManager to enable this functionality for start scenes currently being loaded for a given connection.
I've tested this and it's working. At the top of the aforementioned method, add this loop:
You might find a better way to make this check, but I hope this at least gets the point across. The loop will check if a scene is currently being loaded for the connection and simply return. The scene loading loop will do the rest and invoke OnClientLoadedStartScenes for us once their connection scene is loaded and the client sends a confirmation back. The pending load isnt necessary since the LoadConnectionScene will also add that for us.
The reason I'm asking for this is because I'm trying to accomplish an async player spawner that uses the OnClientLoadedStartScenes callback to spawn the prefab for them on the server. Without it, the client would still be loading there scene and have their player spawned in on the yet-to-be-unloaded offline scene, which makes no orderly sense. I realize I could use a different callback like OnLoadEnd, but I figured it's more proper to use the other one since that's what FN's default player spawner does.
I realize this is kind of niche, especially since i need to load the scene before authentication so the spawner works as intended. But even a callback or predicate at the top of that method would suffice!
Beta Was this translation helpful? Give feedback.
All reactions