Unity Warning: Multiple NetworkManagers detected in the scene

So I haven’t faced any fatal problems with this yet, but I was wondering if there was a reason I was getting this warning and if there was a way to avoid it. I did exactly as it was shown in the first ~3 minutes of the video but I did not happen to notice the warning appear on the tutorial.

I have a secondary personal project I am working on along side this course and I noticed I have a similar problem there as well. Does anyone have any advice? Thanks in advance!

Hi there, try searching your scene for NetworkManagers or classes you have made that inherit from NetworkManager, and see if you accidently added it twice or added it to a second game object. I think there is also a solve for the bug where you remove the NetworkManager and re-add it.

Seems like that was part of it (I had a NetworkManager in the Map_01 Scene) but I get a similar issue once I stop hosting and revert back from the Map_01 scene to the Menu scene.

If it helps at all, in my side project I get this issue (minus the MissingReferenceException) by simply stopping the host even though I am never actually changing scenes.

As far as the warning is concerned, I assume it is because I am going from online to offline and loading the scene set as the “Offline Scene” in the RTS Network Manager’s Scene Management. So upon loading back to the Menu scene I am bringing the original NetworkManager along side creating a new one (as the prefab is in the hierarchy for the Menu Scene).

The Network Manager is set to DontDestroyOnLoad, so you don’t need one in your Map Scene for sure. It shouldn’t create a duplicate either when you return to the Scene_Menu. Is that missing Reference Exception Occurring in the Network Manager? Are all your NetworkManager settings applied to the prefab?

Yea I removed the extra NetworkManager that was on the Map scene so thank you for that suggestion.

I did however realize that the source of the problem regarding the missing Reference Exception is related to UnitSelectionHandler and is directed towards the temporary fix shown in the tail end of this lecture so I assume that will eventually be solved at a later point.

As far as I am aware all of the settings used in the NetworkManager prefab has all of the appropriate settings applied to it. So I’m still unfortunately at a loss as to why that warning comes up about a duplicate NetworkManager.

Can you show the hierarchy in the scene view when the error occurs? Are there two network managers visible there?

This is right after hosting the game then stopping the host. I imagine that even if there would have been an additional NetworkManager it would be automatically deleted based on the warning stating that the duplicate NetworkManager will be destroyed.

Edit: Just to clarify, you can disregard both of the Errors below as those both seem to be addressed in later videos.

Well it looks like there is only one NetworkManager in the hierarchy, so that’s good. You can try going to your NetworkManager and removing the MyNetowrkManager Script and then re-adding it and setting it up again.

I went ahead and deleted the NetworkManager prefab in the Menu scene, went into the NetworkManager prefab settings, cleaned out all of its components, added the…

  • RTSNetworkManager script (along with its settings for offline scene, online scene, player prefab, unit spawner prefab, and the 2 spawnable prefabs)
  • Ensured the Kcp Transport script is there and has the same settings
  • Network Manager HUD

Then of course readded the NetworkManager prefab in the Menu scene. But unfortunately the warning is still appearing. I did a few google searches on it as well and some people seem to claim its on Mirror’s end. I just wasn’t sure if anyone else taking this course is running into the same warning or if it was just on my end.

You can always delete the Mirror folder and reimport it. What version of Unity are you using?

At the moment I am using version 2019.4.17f1 since it what was recommended by unity when I installed it some time ago. I know the course states that it will be using Unity 2020, but I figured I would continue using what I was before since I was honestly also curious if there were any major differences as well as me being afraid of breaking other projects I had previously created if I installed a new version lol.

Edit: I will install a later version of Unity tonight when I get home from work and let you know of any progress!

I only mentioned the version because there have been issues with unity 2020.2 and mirror. So if you install a new version go for 2020.1.

I installed unity 2020.1, updated the project to the new unity version as well as deleted the Mirror folder, then reimported the asset but the warning is still there. Seems to be quite stubborn.

Well I suppose at this point, it’s just a warning, but if you want I can try and hunt down the cause. You can upload your project here:
https://gdev.tv/projectupload

Oh yea like I said, it hasn’t become a problem as of yet. I was mostly curious if there was a solution since it is good practice to fix bugs/warnings when they pop up. If you ever find yourself bored (As I’m sure you always have your hands full lol) you are more than welcome to take a peek and see if you can find anything but it is not a huge deal otherwise. Either way, I appreciate the time and effort you’ve put in thus far. :slight_smile:

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms