Unity-Technologies / com.unity.netcode.gameobjects

Netcode for GameObjects is a high-level netcode SDK that provides networking capabilities to GameObject/MonoBehaviour workflows within Unity and sits on top of underlying transport layer.
MIT License
2.13k stars 432 forks source link

Intercepting SwitchScene For Clients #773

Open DapperDino opened 3 years ago

DapperDino commented 3 years ago

Is your feature request related to a problem? Please describe. When trying to implement a loading screen for switching scenes I tried using the OnSceneSwitchStarted event to start fading to black and OnSceneSwitched event to start fading the loading screen back to being transparent. The issue here is that OnSceneSwitchStarted and the call to SceneManager.LoadSceneAsync happen at the same time meaning that the player sees the scene loading start taking place before the screen has finished fading to black.

Describe the solution you'd like Allow the client to intercept and delay the call to SceneManager.LoadSceneAsync until we are ready (in my case it would be when the screen has fully faded to black but it could be anything). The flow should be:

  1. Receive message to change scene
  2. Fade over time to black
  3. Load scene
  4. (When scene has loaded) Fade over time to transparent

Describe alternatives you've considered Writing my own NetworkSceneManager from scratch which I think would be awkward to integrate/replace the built in NetworkSceneManager with but regardless, I do think this should be a part of MLAPI considering almost every game out there has loading screens.

f09f909b commented 2 years ago

Hello, a first time contributor here!

I was wondering if I could work on this issue?