protected override void Awake() { base.Awake(); if (instance != null) { GameObject go = instance.gameObject; go.SetActive(false); Destroy(go); } instance = this; DontDestroyOnLoad(gameObject); }
protected override void Awake() { base.Awake(); if (instance != null) { GameObject go = instance.gameObject; go.SetActive(false); Destroy(go); } instance = this; DontDestroyOnLoad(gameObject); }
protected void FindEventSystems() { if (!Application.isPlaying && m_EventSystem == null) { m_EventSystem = FindObjectOfType <EventSystem>(); if (m_EventSystem != null && !(m_EventSystem is SSEventSystemAutoDestroy)) { GameObject go = m_EventSystem.gameObject; SSEventSystemAutoDestroy esad = go.AddComponent <SSEventSystemAutoDestroy>(); DestroyImmediate(m_EventSystem); m_EventSystem = esad; } } }