Hello,
The C# scripting environement in Unity3D (runned under Mono) has a nice behavior when detroying objects. All the references that point to the destroyed object gets automaticly null :
GameObject ref1 = (GameObject)Instantiate(obj);
GameObject ref2 = ref1;
if (ref1 != null)
Debug.Log("ref1 is not null");
DestroyImmediate(ref1);
if (ref1 == null)
Debug.Log("ref1 is null");
if (ref2 == null)
Debug.Log("ref2 is null");
Output :
ref1 is not null
ref1 is null
ref2 is null
Any ideas on how to acheive this ?
Thanks