private void Start() { if (m_button == null) { m_button = GetComponent <Button>(); } if (m_eventSystem == null) { m_eventSystem = GetComponentInParent <IndependentEventSystem>(); } m_button.onClick.AddListener(OnButtonClick); }
protected virtual void Start() { if (m_eventSystem == null) { m_eventSystem = GetComponentInParent <IndependentEventSystem>(); } if (m_eventSystem == null) { m_eventSystem = UnityEventSystem.current as IndependentEventSystem; } if (m_selectable == null) { m_selectable = GetComponent <Selectable>(); } m_eventSystem.EventSystemUpdate -= OnEventSystemUpdate; m_eventSystem.EventSystemLateUpdate -= OnEventSystemLateUpdate; m_eventSystem.EventSystemUpdate += OnEventSystemUpdate; m_eventSystem.EventSystemLateUpdate += OnEventSystemLateUpdate; }