com.unity.netcode.gameobjects
com.unity.netcode.gameobjects copied to clipboard
Request to make NetworkManager.OnSingletonReady public
I ask if it's possible to turn this internal event into a public, this event already exists in the NetworkManager.

It would be nice just to have, for people who wish to subscribe to that event in a non-monobehaviour script, or static scripts, or in RuntimeInitializeOnLoadMethod, etc.
Thank you!
+1
It is so frequent to have components get a NetworkManager.Singleton == null in OnEnable or Start depending on the order the game objects get these calls. That order you can rely on for a loooong time until one point, you make a change to the scene and suddenly everything is broken, primarily the event callbacks.
In the meantime, here's an extension method NetworkManagerExt.InvokeWhenSingletonReady(Action) that hooks into the internal OnSingletonReady via reflection (if the singleton is already initialized, the action is called directly):
https://github.com/CodeSmile-0000011110110111/de.codesmile.netcode/blob/main/Runtime/Extensions/NetworkManagerExt.cs