Beispiel #1
0
 internal void ClearDrivenProperties()
 {
     SerializationUtility.UnregisterDrivenProperty(this, this, "m_Mesh");
     if (gameObject != null && gameObject.TryGetComponent(out MeshCollider meshCollider))
     {
         SerializationUtility.UnregisterDrivenProperty(this, meshCollider, "m_Mesh");
     }
 }
Beispiel #2
0
        // Using the internal callbacks here to avoid registering this component as "enable-able"
        void OnDisableINTERNAL()
        {
            // Don't call DrivenPropertyManager.Unregister in OnDestroy. At that point GameObject::m_ActivationState is
            // already set to kDestroying, and DrivenPropertyManager.Unregister will try to revert the driven values to
            // their previous state (which will assert that the object is _not_ being destroyed)
            MeshCollider meshCollider;

            if (gameObject.TryGetComponent(out meshCollider))
            {
                SerializationUtility.UnregisterDrivenProperty(this, meshCollider, "m_Mesh");
            }
        }
Beispiel #3
0
        void RefreshCollisions()
        {
            mesh.RecalculateBounds();
            MeshCollider collider;

            if (gameObject.TryGetComponent <MeshCollider>(out collider))
            {
                SerializationUtility.UnregisterDrivenProperty(this, collider, "m_Mesh");
                SerializationUtility.RegisterDrivenProperty(this, collider, "m_Mesh");
                collider.sharedMesh = null;
                collider.sharedMesh = mesh;
            }
        }