// Use this for initialization
 void Start()
 {
     if (Instance != null)
     {
         GameObject.Destroy(gameObject);
     }
     else
     {
         GameObject.DontDestroyOnLoad(gameObject);
         Instance = this;
     }
 }
Exemple #2
0
    // Use this for initialization
    void Start()
    {
        if (Instance != null)
        {
            GameObject.Destroy(gameObject);
        }
        else
        {
            GameObject.DontDestroyOnLoad(gameObject);
            Instance = this;
        }

        Button btn = AdventureButton.GetComponent <Button>();

        btn.onClick.AddListener(loadAdventure);
    }