void Awake() { if (instance != null) { Debug.LogError("Double instance singleton"); return; } instance = this; foreach (var obj in objects) { DontDestroyOnLoad(obj); } }
private void Awake() { if (instance != null) { Debug.LogWarning("Il y a plus d'un DontDestroyOnLoadScene"); return; } instance = this; foreach (var element in objects) { DontDestroyOnLoad(element); } }
// Start is called before the first frame update void Awake() { if (instance == null) { instance = this; } else { Destroy(this); } foreach (GameObject g in objects) { DontDestroyOnLoad(g); } }
void Awake() { if (instance != null) { Debug.LogWarning("There is more than one instance of DontDestroyOnLoadScene in the scene."); return; } instance = this; foreach (var element in objects) { DontDestroyOnLoad(element); } }