[HELP] Event System

Hi i was trying to use event system, its great but i doing something that i need to set it on a canvas, not in the component itself

using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
using System.Collections;

public class IComponents : MonoBehaviour, IDeselectHandler, ISelectHandler, ISubmitHandler
{
   
    //public Button[] btns;
    //public Slider[] sld;




    public void OnDeselect(BaseEventData eventData)
    {
        Debug.Log("OnDeselect" + eventData.selectedObject.GetComponentInChildren<Button>().name);
    }

    public void OnSelect(BaseEventData eventData)
    {
        Debug.Log("OnSelect" + eventData.selectedObject.GetComponentInChildren<Button>().name);
    }

    public void OnSubmit(BaseEventData eventData)
    {
        Debug.Log("OnSubmit" + eventData.selectedObject.GetComponent<Button>().name);
    }
}

Can’t do that. Events (when fired) are targetted on the gameObject that the raycast (in the event system) has identified. Can’t do global / generic events at present.

Nothing stopping you creating your own version through :smile:

1 Like

Thanks a lot, im kinda newbie and havent code for a long time, need some refreshment hehehe