Skip to content

Objects instantiated in Start() are move to Moved Objects Holder after scene change #1038

Description

@ural89

After a scene change when object is instantiated on start (not an networked object just a regular monobehavior), It is moved to "MovedObjectsHolder" and it stays there forever. Even if you change the scene again.
Changing Scene:

public void LoadScene(string sceneName)
    {
        if (!InstanceFinder.IsServerStarted)
        {
            return;
        }

        SceneLoadData sceneLoadData = new SceneLoadData(sceneName);
        sceneLoadData.ReplaceScenes = ReplaceOption.All;
        InstanceFinder.SceneManager.LoadGlobalScenes(sceneLoadData);
    }

Replicating the issue:
After a scene change:

   private void Start()
    {
        monoBehaviourGameObject = Instantiate(monoBehaviourGameObjectPrefab);
    }

if you Instantiate with a transform specified however, it will be not moved into MovedObjectsHolder.

   private void Start()
    {
        monoBehaviourGameObject = Instantiate(monoBehaviourGameObjectPrefab, transform);
    }

Fishnet:4.6.18R
Unity Ver: 2022.3.62f2

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions