I have used a custom (system) EventHandler I created:
public event EventHandler<T> OnItemSelected;
I am then assigning a custom anonymous function:
.OnItemSelected += (...) => {};
However I am pretty sure that it isn't cleaning itself and when my gameObject
is destroyed this causes a memory leak.
How can I prevent this ? Should I replace my EventHandler
by a UnityEvent
and use RemoveAllListeners
?