- Home /
Possible Memory Leak or Issue With Unity Event Implementation/Usage
Hello,
I'm facing this issue for the following use case of using Unity Event :
Have a reference of Unity Event Object.
Add any number of listeners to it.
Invoke the event once.
Now Remove each event listener one by one.
Now in above scenario , until I release the instance of the event listener , the listener basically holds a reference to the target of each listener, even though I have removed the listeners. I could trace this to how the copy of listener targets are maintained inside 'm_executingCalls' list internally.
Now is there something wrong by the way I'm trying to use Unity Events or is there something else I'm missing. Seems like a fairly usual way in which someone would use the API.
Thanks For Reading.
Answer by jetjalopy · Jan 25 at 09:25 AM
I also ran into this issue in Unity 2020.3.25. I am using reflection after calling RemoveAllListeners to get and clear 'm_ExecutingCalls' list without calling persistent calls.
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
How can i check/wait until the gameobject will end the rotation ? 1 Answer