Event data not showing in Inspector

I followed this tutorial:

this is my inspector:

In the tutorial is the event data just up in the function select thingy


but for me it is not and I already tried dragging the gamobject itself in and dragging just the script in but still the same result

Any help is appreciated :slight_smile:

Well, without you sharing the script whose member is supposed to appear in the events list there’s nothing anyone can do to help…

I can already spot a difference between your screenshot and the tutorial one: the event object in the tutorial is a prefab (game object) while yours is not.

Here is the code

using TMPro;
using UnityEngine.UI;
using UnityEngine;
using System;
using UnityEngine.EventSystems;

public class InventoryItem : MonoBehaviour
{
    [Header("References")]
    public Image itemImage;
    public TMP_Text quantityText;
    public Image selectedPanel;

    [Header("Stats")]
    public bool isFull = true;

    //Other stuff
    public event Action<InventoryItem>
     OnItemClicked, OnItemDroppedOn, OnItemBeginDrag,
     OnItemEndDrag, OnRightMouseButtonClick;


    public void Awake()
    {
        ResetData();
        Deselect();
    }
    public void ResetData()
    {
        itemImage.gameObject.SetActive(false);
        isFull = true;
    }
    public void Deselect()
    {
        selectedPanel.enabled = false;
    }
    public void SetData(Sprite sprite, int quantity)
    {
        itemImage.gameObject.SetActive(true);
        itemImage.sprite = sprite;
        quantityText.text = quantity + "";
        isFull = false;
    }

    public void Select()
    {
        selectedPanel.enabled = true;
    }

    public void OnPointerClick(PointerEventData pointerData)
    {
        if (pointerData.button == PointerEventData.InputButton.Right)
        {
            OnRightMouseButtonClick?.Invoke(this);
        }
        else
        {
            OnItemClicked?.Invoke(this);
        }
    }

    public void OnEndDrag(PointerEventData eventData)
    {
        OnItemEndDrag?.Invoke(this);
    }

    public void OnBeginDrag(PointerEventData eventData)
    {
        if (isFull)
            return;
        OnItemBeginDrag?.Invoke(this);
    }

    public void OnDrop(PointerEventData eventData)
    {
        OnItemDroppedOn?.Invoke(this);
    }

    public void OnDrag(PointerEventData eventData)
    {

    }
}

OnPointerClick takes BaseEventData as argument, not PointerEventData (as shown in the tutorial at 10:30).

If your function’s signature doesn’t match the event’s, it won’t show up as an option in the inspector dropdown since they cannot be linked together: the event is sending oranges, but your function is expecting apples instead.

2 Likes