Пример #1
0
    void Awake()
    {
        if (Instance != null && Instance != this) {
            Destroy(gameObject);
            return;
        }

        Instance = this;

        DontDestroyOnLoad (gameObject);
    }
Пример #2
0
 private void Start()
 {
     if (Instance == null)
     {
         Instance = this;
     }
     else if (Instance != this)
     {
         Destroy(gameObject);
     }
     DontDestroyOnLoad(gameObject);
 }
 void Awake()
 {
     if (!instance)
     {
         instance = this;
     }
     else
     {
         Destroy(this.gameObject);
     }
     DontDestroyOnLoad(this.gameObject);
 }
Пример #4
0
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else
     {
         Destroy(gameObject);
     }
     DontDestroyOnLoad(gameObject);
 }
Пример #5
0
 void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
     }
     else
     {
         Destroy(this.gameObject);
         return;
     }
 }
 private void Awake()
 {
     if (_instance != null && _instance != this)
     {
         Destroy(this.gameObject);
     }
     else
     {
         _instance = this;
         DontDestroyOnLoad(gameObject);
     }
 }
 void Awake()
 {
     DontDestroyOnLoad(this);
     if (multitonInstance == null)
     {
         multitonInstance = this;
     }
     else
     {
         Destroy(gameObject);
     }
 }
Пример #8
0
 void Awake()
 {
     if (Instance) // PRevents creation of camera clones when loading new level
     {
         Destroy(gameObject);
     }
     else
     {
         DontDestroyOnLoad(gameObject);
         Instance = this;
     }
 }
 private void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
         DontDestroyOnLoad(this);
     }
     else
     {
         Destroy(gameObject);
     }
 }
Пример #10
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this; // In first scene, make us the singleton.
         DontDestroyOnLoad(gameObject);
     }
     else if (instance != this)
     {
         Destroy(gameObject); // On reload, singleton already set, so destroy duplicate.
     }
 }
Пример #11
0
 void Awake()
 {
     if (Instance == null)
     {
         DontDestroyOnLoad(gameObject);
         Instance = this;
     }
     else if (Instance != this)
     {
         Destroy(gameObject);
     }
 }
Пример #12
0
 private void Awake()
 {
     DontDestroyOnLoad(this);
     if (dontDestroy == null)
     {
         dontDestroy = this;
     }
     else
     {
         Destroy(this.gameObject);
     }
 }
Пример #13
0
 public void SetSingleton()
 {
     if (instance == null)
     {
         instance = this;
         DontDestroyOnLoad(this);
     }
     else if (instance != this)
     {
         DestroyImmediate(gameObject);
     }
 }
Пример #14
0
 void Start()
 {
     if (instance == null)
     {
         instance = this;
         DontDestroyOnLoad(gameObject);
     }
     else
     {
         Destroy(gameObject);
     }
 }
 void Awake()
 {
     if (instance != null)
     {
         Destroy(gameObject);
     }
     else
     {
         instance = this;
         GameObject.DontDestroyOnLoad(gameObject);
     }
 }
 void Start()
 {
     if(Instance != null)
     {
         GameObject.Destroy(gameObject);
     }
     else
     {
         DontDestroyOnLoad(gameObject);
         Instance = this;
     }
 }
Пример #17
0
 void Awake()
 {
     if (Instance)
     {
         DestroyImmediate(gameObject);
     }
     else
     {
         DontDestroyOnLoad(gameObject);
         Instance = this;
     }
 }
 private void Awake()
 {
     if (instanceRef == null)
     {
         instanceRef = this;
         DontDestroyOnLoad(gameObject);
     }
     else if (instanceRef != this)
     {
         Destroy(gameObject);
     }
 }
Пример #19
0
 // Start is called before the first frame update
 void Start()
 {
     DontDestroyOnLoad(this);
     if (obj == null)
     {
         obj = GetComponent <DontDestroyOnLoad>();
     }
     else
     {
         Destroy(gameObject);
     }
 }
Пример #20
0
 void Awake()
 {
     if (instance != null && instance != this)
     {
         Destroy(this.gameObject);
         return;
     }
     else
     {
         instance = this;
     }
     DontDestroyOnLoad(this.gameObject);
 }
Пример #21
0
    void Awake()
    {
        DontDestroyOnLoad(this);

        if (dontDestroyOnLoad == null)
        {
            dontDestroyOnLoad = this;
        }
        else
        {
            Destroy(gameObject);
        }
    }
    private void Awake()
    {
        if (Instance != null)
        {
            Debug.Log($"There were multiple Instances of {this} in the scene. Deleting {name}");

            Destroy(gameObject);
            return;
        }

        Instance = this;
        DontDestroyOnLoad(this);
    }
Пример #23
0
 // Use this for initialization
 void Awake()
 {
     if (control == null)
     {
         DontDestroyOnLoad(gameObject);
         control = this;
     }
     else if (control != null)
     {
         Destroy(gameObject);
     }
     DontDestroyChildOnLoad(this.gameObject);
 }
Пример #24
0
 private void Awake()
 {
     if (instance != null)
     {
         Destroy(this.gameObject);
     }
     else
     {
         instance = this;
         transform.SetParent(null);
         DontDestroyOnLoad(gameObject);
     }
 }
Пример #25
0
 protected override void OnAwake()
 {
     if (_instance == null)
     {
         DontDestroyOnLoad(gameObject);
         _instance = this;
     }
     if (_instance == this)
     {
         return;
     }
     Destroy(gameObject);
 }
Пример #26
0
    void Awake()
    {
        DontDestroyOnLoad(this);

        if (gameComponent == null)
        {
            gameComponent = this;
        }
        else
        {
            DestroyImmediate(this);
        }
    }
Пример #27
0
 // Start is called before the first frame update
 private void Awake()
 {
     if (estadoJuego == null)
     {
         estadoJuego = this;
         DontDestroyOnLoad(gameObject);
         PlayGamesPlatform.Activate();
         PlayGamesPlatform.DebugLogEnabled = false; //OJO desactivar al finalizar
     }
     else if (estadoJuego != this)
     {
         Destroy(gameObject);
     }
 }
Пример #28
0
 void Awake()
 {
     if (!created)
     {
         DontDestroyOnLoad(this.gameObject);
         created   = true;
         thisAudio = this;
     }
     else
     {
         Destroy(this.gameObject);
         thisAudio.Start();
     }
 }
    // Use this for initialization
    void Awake()
    {
        if (instance != null)
        {
            Debug.LogError("Erreur : Il y a plus d'un script DontDestroyOnLoad dans la scène.");
            Destroy(gameObject);
        }
        else
        {
            instance = this;
        }


        DontDestroyOnLoad(gameObject);
    }
Пример #30
0
 //------------------------------------
 private void Awake()
 {
     //para que no haya mas de un audio manager en la escena
     if (instance == null)
     {
         instance = this;
     }
     else
     {
         Destroy(gameObject);
         return;
     }
     //-----------------------------------------------------
     DontDestroyOnLoad(gameObject);
 }
Пример #31
0
 void Awake()
 {
     if (_instance == null)
     {
         _instance = this;
         DontDestroyOnLoad(this);
     }
     else
     {
         if (this != _instance)
         {
             Destroy(this.gameObject);
         }
     }
 }
Пример #32
0
    private void Awake()
    {
        if (instance != null && instance != this)
        {
            Destroy(this.gameObject);
            return;
        }
        else
        {
            instance = this;
        }
        DontDestroyOnLoad(this.gameObject);

        audioSource = GetComponent <AudioSource>();
    }