Hi There,
My goal is to create a cache of weak references, such that I can store and reference objects in the cache at will and if the objects are ever dereferenced elsewhere, the cache will not stop the garbage collector from purging them from memory.
There are at least threads threads in this forum which bring up mentions of WeakReferences: (the first is directly on point)
http://forum.unity3d.com/threads/63206-Garbage-collection-and-hashtable
http://forum.unity3d.com/threads/99176-static-vars-that-gets-destroyed?highlight=WeakReference
http://forum.unity3d.com/threads/116384-Finalize-function-called-from-separate-thread-How-to-deal-with-(C-)?highlight=WeakReference
I found the WeakReferences Class reference for .NET 2 at WeakReference Class (System) | Microsoft Learn
I tried " new WeakReference (whatever.gameObject)" but the compiler complains it doesn’t know the identifier WeakReference. Does anyone know if WeakReference is available for JS users or if there is another solution for a cache of weak referenced objects?