1
votes

Codes

Firstly hi to all, i have a problem im tring to understand this last 2 days but i dont have any idea. i added the codes but lemme explain: i have 3 script "ItemSlot", "Inventory", "InventoryManager" and i have a event on item slot, inventory add this event its own event, and in inventorymanager im adding a func. to this event but after all of this progress event is still null can someone help me about this how and why ?

1
Which event is null? When does it it evaluate to null? The observed behavior is unclear. There is not enough information in the question (including scene, gameobject, component setup) to reproduce anything that sounds like the observed behavior. Please edit the question to include a minimal reproducible example and describe the observed behavior in clearer detail.Ruzihm

1 Answers

0
votes

Invoke the event using Invoke

if (item != null)
{
    OnRightClickEvent?.Invoke(item); // <= Invokes the event if not null
}

The Null Conditional Operator ?. is used to check if anything has subscribed to the event.