Let’s suppose we have code like this:
public class ComponentA : MonoBehaviour {
B b;
void Start() {
b = new B();
b.a = this;
}
}
public class B {
public ComponentA a;
}
So will memory be freed (ComponentA destroyed) after destroying game object with attached ComponentA?
I’m not sure, but answer is yes. So for which reason there is WeakReference<> in System namespace?