How do I declare a weak delegate (C #)?
I'm going to use weak delegates to listen for some events. Basically, so as not to worry about unsubscribing all the time.
If I am correct, using a strong referential (default) delegate does not allow the subscriber object to be freed from memory, which I want to avoid.
But I'm not sure how to declare weak delegates using UnityEngine, and a subset of .Net 2.0 in Unity 3D. Should I use WeakReference
it somehow?
+3
source to share
1 answer
For anyone who needs to use ConditionalWeakTable or WeakReference in .NET 3.5 for Unity, there is a way back here: https://github.com/theraot/Theraot/wiki/Features
+1
source to share