Don't Destroy On Load Object Destroying on Spawn

Only one Instantiated player that used Don’t Destroy On Load will be spawned the others will be removed immediately.

Don’t Destroy On Load Script:

void Awake()
    {
        InstantiateController();
    }

    private void InstantiateController()
    {
        if (Instance == null)
        {
            Instance = gameObject;
            DontDestroyOnLoad(gameObject);
        }
        else if (this != Instance)
        {
            Destroy(gameObject);
        }
    }

Scene Detection:

bool changed = false;
    bool changed2 = true;
    bool changed3 = false;
    // Update is called once per frame
    void Update()
    {
        Scene scene = SceneManager.GetActiveScene();

        if (scene.name == "PlayScene" && !changed)
        {
            changed = true;
            changed2 = false;
            changed3 = false;
            transform.position = new Vector3(0, -3.485f);
            GameObject.Find("WaveHandler").GetComponent<Wave>().startingTargets.Add(transform);
            plrnum = GameObject.Find("WaveHandler").GetComponent<Wave>().startingTargets.Count;
        }
        if(scene.name == "MainMenu" && !changed2)
        {
            changed = false;
            changed2 = true;
            changed3 = false;
            transform.position = new Vector3(0, -3.485f);
            GameObject.Find("WaveHandler").GetComponent<Wave>().startingTargets.Add(transform);
            plrnum = GameObject.Find("WaveHandler").GetComponent<Wave>().startingTargets.Count;
        }
        if (scene.name == "TestScene" && !changed3)
        {
            changed = false;
            changed2 = false;
            changed3 = true;
            transform.position = new Vector3(0, -3.485f);
            GameObject.Find("WaveHandler").GetComponent<Wave>().startingTargets.Add(transform);
            plrnum = GameObject.Find("WaveHandler").GetComponent<Wave>().startingTargets.Count;
        }
     }

Input Manager:
201794-image-2022-11-13-165234784.png

If you need more info just tell me! Thanks!!!

If anyone is having this problem cause I couldn’t find anyone with the same issue and an answer I found a solution just make sure the objects you need on do not destroy on load is in a root gameobject.
Don’t worry I’ll give the code to :smiley:

private void LateUpdate()
    {
        GameObject[] objs = GameObject.FindGameObjectsWithTag("Player");
        foreach (GameObject g in objs)
        {
            g.transform.parent = transform;
        }
    }

Just change the tag to the tags you need or a list you have.