public override void OnDestroy() { base.OnDestroy (); //Clean up a reference in a static variable which otherwise should point to this graph forever and stop the GC from collecting it RemoveGridGraphFromStatic (); }