void OnEnable() { m_initialized = false; Renderer renderer = GetComponent <Renderer>(); if (renderer != null) { // At this point, Renderer is guaranteed to be one of the following if (renderer.GetType() == typeof(MeshRenderer)) { m_type = AmplifyMotionObjectType.Solid; } else if (renderer.GetType() == typeof(SkinnedMeshRenderer)) { m_type = AmplifyMotionObjectType.Skinned; } #if UNITY_3 || UNITY_4 else if (renderer.GetType() == typeof(ClothRenderer)) { m_type = AmplifyMotionObjectType.Cloth; } #endif AmplifyMotionEffectBase.RegisterObject(this); } if (m_applyToChildren) { foreach (Transform child in gameObject.transform) { AmplifyMotionEffectBase.RegisterRecursivelyS(child.gameObject); } } // No renderer? disable it, it is here just for adding children if (renderer == null) { enabled = false; } }
void OnEnable() { m_initialized = false; Renderer renderer = GetComponent<Renderer>(); if ( renderer != null ) { // At this point, Renderer is guaranteed to be one of the following if ( renderer.GetType() == typeof( MeshRenderer ) ) m_type = AmplifyMotionObjectType.Solid; else if ( renderer.GetType() == typeof( SkinnedMeshRenderer ) ) m_type = AmplifyMotionObjectType.Skinned; #if UNITY_3 || UNITY_4 else if ( renderer.GetType() == typeof( ClothRenderer ) ) m_type = AmplifyMotionObjectType.Cloth; #endif AmplifyMotionEffectBase.RegisterObject( this ); } if ( m_applyToChildren ) { foreach ( Transform child in gameObject.transform ) AmplifyMotionEffectBase.RegisterRecursivelyS( child.gameObject ); } // No renderer? disable it, it is here just for adding children if ( renderer == null ) enabled = false; }