NetworkManager should warn when a duplicate exists (Singleton already non-null) #2949
Labels
stat:awaiting triage
Status - Awaiting triage from the Netcode team.
type:feature
New feature, request or improvement
Is your feature request related to a problem? Please describe.
It is very common to have NetworkManager object duplicated. Thus the singleton is no longer a single instance and all sorts of issues will occur.
As a consequence, it's commonplace to "recommend" destroying the NetworkManager object upon shutdown with who-knows-what kind of side-effects this may have.
In fact following the NGO manual will easily lead to the issue where NetworkManager gets duplicated.
The cause is really simple: loading another scene that contains a NetworkManager. The most common cause is actually "restarting the game" simply by loading the one and only scene again.
Describe the solution you'd like
In the editor and debug builds a warning should be logged to the console. Perhaps even throwing an exception might be in order.
This message should include the cause (loading a scene with NetworkManager in it, but it could also be caused by instantiating a prefab with NetworkManager in it) and the resolution (add NetworkManager to a scene that will not be loaded again, add a launch scene if necessary).
Describe alternatives you've considered
Educating users but alas, given that the NGO manual provides the basis it has been used in projects and tutorials everywhere and keeps spreading.
The text was updated successfully, but these errors were encountered: