Behaviour object that signals when it is destroyed.
Inheritance: UnityEngine.MonoBehaviour
Example #1
0
 private void ReplaceProxy()
 {
     if (destructionProxy != null) {
         destructionProxy.onDestroy -= this.OnProxyDestroyed;
     }
     GameObject obj = new GameObject("KerbCam.CameraController DestructionProxy");
     destructionProxy = obj.AddComponent<DestructionProxy>();
     destructionProxy.onDestroy += OnProxyDestroyed;
     TransformState.MoveToParent(transform, destructionProxy.transform);
 }
Example #2
0
 private void OnProxyDestroyed(DestructionProxy p)
 {
     if (object.ReferenceEquals(p, destructionProxy)) {
         ReplaceProxy();
         // The destruction of the proxy probably indicates that the
         // relative object has been destroyed. Reparent to default.
         relativeTrn = null;
         UpdateTransformReferences();
     }
 }