ArgumentException: Gameobject is not a root in a scene

I’m using Fish-Networking for my multiplayer game. There were no problem since I updated to it’s new version (v1.4.2), where I get this error below:

ArgumentException: Gameobject is not a root in a scene
UnityEngine.SceneManagement.SceneManager.MoveGameObjectToScene (UnityEngine.GameObject go, UnityEngine.SceneManagement.Scene scene) (at <8b27195d2ee14da7b6fd1e5435850f80>:0)
FishNet.Managing.Scened.SceneManager.MoveClientHostObjects (UnityEngine.SceneManagement.Scene scene, System.Boolean asServer) (at Assets/FishNet/Runtime/Managing/Scened/SceneManager.cs:1328)
FishNet.Managing.Scened.SceneManager+<__LoadScenes>d__78.MoveNext () (at Assets/FishNet/Runtime/Managing/Scened/SceneManager.cs:767)
UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at <8b27195d2ee14da7b6fd1e5435850f80>:0)
UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
FishNet.Managing.Scened.<__ProcessSceneQueue>d__71:MoveNext() (at Assets/FishNet/Runtime/Managing/Scened/SceneManager.cs:461)
UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
FishNet.Managing.Scened.SceneManager:QueueOperation(Object) (at Assets/FishNet/Runtime/Managing/Scened/SceneManager.cs:444)
FishNet.Managing.Scened.SceneManager:LoadGlobalScenesInternal(SceneLoadData, String[], Boolean) (at Assets/FishNet/Runtime/Managing/Scened/SceneManager.cs:496)
FishNet.Managing.Scened.SceneManager:LoadGlobalScenes(SceneLoadData) (at Assets/FishNet/Runtime/Managing/Scened/SceneManager.cs:481)
SceneChanger:LoadGameScene(Int32) (at Assets/_Content/Scripts/SceneChanger/SceneChanger.cs:50)
MainMenuSceneManager:BeginClick() (at Assets/_Content/Scripts/SceneManagers/MainMenuSceneManager/MainMenuSceneManager.cs:87)
UnityEngine.EventSystems.EventSystem:Update() (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/EventSystem/EventSystem.cs:501)

It happens when I try to load a new scene.
I asked on their discord and they told me that was something unity related. Can someone please tell me what this error means? Rolling back to their old (v1.3.4) version it works again, but that’s annoying… what could it be?

If you start with the docs:

You’ll see it explain this limitation as the very first thing in its list of notes.

From the callstack, it looks like its their FishNet stuff doing this, and specifically calling MoveGameObjectToScene, probably on what we can safely assume is not a root GameObject.

Some ways this might happen:

  • the thing FishNet is trying to move is misconfigured as NOT a root GameObject in your project,
  • the new FishNet version has new functionality
  • the new FishNet version functionality is subtly different
  • the new FishNet version has a bug
  • etc.

Find what it wants to move, then you can begin to reason about which of the above might be happening.

This is not a bug. Unity only allows you to move root objects between scenes. Fish-Networking is enforcing that behavior. If you tried to do the same thing on an older Fish-Networking version the warning won’t be thrown by FishNet, but Unity will still complain.

1 Like