Behaviour object that signals when it is destroyed.
Inheritance: UnityEngine.MonoBehaviour
Ejemplo n.º 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);
 }
Ejemplo n.º 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();
     }
 }