Check out example codes for "dont destroy on load unity". It will help you in understanding the concepts better.

Code Example 1

using System.Collections;
using System.Collections.Generic;
using UnityEngine;// Object.DontDestroyOnLoad example.
// This script example manages the playing audio. The GameObject with the
// "music" tag is the BackgroundMusic GameObject. The AudioSource has the
// audio attached to the AudioClip.public class DontDestroy : MonoBehaviour
    void Awake()
        GameObject[] objs = GameObject.FindGameObjectsWithTag("music");        if (objs.Length > 1)
        }        DontDestroyOnLoad(this.gameObject);

Code Example 2


Learn ReactJs, React Native from