Search Unity

  1. Unity 2020.1 has been released.
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

EventSystem.current printing null

Discussion in 'Input System' started by the_mr_matt, Aug 1, 2020.

  1. the_mr_matt

    the_mr_matt

    Joined:
    Jul 21, 2015
    Posts:
    97
    Code (CSharp):
    1. private void OnEnable()
    2. {
    3.     Debug.Log(EventSystem.current);
    4.     EventSystem.current.SetSelectedGameObject(gameObject);
    5. }
    Very simple script for selecting a UI element on enable. However, EventSystem.current prints null to the console.

    Unity 2019.3.15f1
    I have an Rewired event system in the scene.

    Also tried putting this in an IEnumerator and waiting a frame before logging to the console - no change.
     
    Last edited: Aug 1, 2020
unityunity