Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NetworkManager should warn when a duplicate exists (Singleton already non-null) #2949

Open
CodeSmile-0000011110110111 opened this issue Jun 12, 2024 · 0 comments
Labels
stat:awaiting triage Status - Awaiting triage from the Netcode team. type:feature New feature, request or improvement

Comments

@CodeSmile-0000011110110111

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.

@CodeSmile-0000011110110111 CodeSmile-0000011110110111 added stat:awaiting triage Status - Awaiting triage from the Netcode team. type:feature New feature, request or improvement labels Jun 12, 2024
@CodeSmile-0000011110110111 CodeSmile-0000011110110111 changed the title NetworkManager should warn when duplicated Jun 12, 2024
@CodeSmile-0000011110110111 CodeSmile-0000011110110111 changed the title NetworkManager should warn when a duplicate exists (Singleton re-initialized) Jun 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stat:awaiting triage Status - Awaiting triage from the Netcode team. type:feature New feature, request or improvement
1 participant