bool InitializeType() { Renderer renderer = GetComponent <Renderer>(); if (AmplifyMotionEffectBase.CanRegister(gameObject, false)) { #if !UNITY_PRE_5_3 ParticleSystem particleRenderer = GetComponent <ParticleSystem>(); if (particleRenderer != null) { m_type = AmplifyMotion.ObjectType.Particle; AmplifyMotionEffectBase.RegisterObject(this); } else #endif if (renderer != null) { // At this point, Renderer is guaranteed to be one of the following if (renderer.GetType() == typeof(MeshRenderer)) { m_type = AmplifyMotion.ObjectType.Solid; } #if UNITY_4 else if (renderer.GetType() == typeof(ClothRenderer)) { m_type = AmplifyMotion.ObjectType.Cloth; } #endif else if (renderer.GetType() == typeof(SkinnedMeshRenderer)) { #if !UNITY_4 if (GetComponent <Cloth>() != null) { m_type = AmplifyMotion.ObjectType.Cloth; } else #endif m_type = AmplifyMotion.ObjectType.Skinned; } AmplifyMotionEffectBase.RegisterObject(this); } } // No renderer? disable it, it is here just for adding children return(renderer != null); }
bool InitializeType() { Renderer renderer = GetComponent<Renderer>(); if ( AmplifyMotionEffectBase.CanRegister( gameObject, false ) ) { #if !UNITY_PRE_5_3 ParticleSystem particleRenderer = GetComponent<ParticleSystem>(); if ( particleRenderer != null ) { m_type = AmplifyMotion.ObjectType.Particle; AmplifyMotionEffectBase.RegisterObject( this ); } else #endif if ( renderer != null ) { // At this point, Renderer is guaranteed to be one of the following if ( renderer.GetType() == typeof( MeshRenderer ) ) m_type = AmplifyMotion.ObjectType.Solid; #if UNITY_4 else if ( renderer.GetType() == typeof( ClothRenderer ) ) m_type = AmplifyMotion.ObjectType.Cloth; #endif else if ( renderer.GetType() == typeof( SkinnedMeshRenderer ) ) { #if !UNITY_4 if ( GetComponent<Cloth>() != null ) m_type = AmplifyMotion.ObjectType.Cloth; else #endif m_type = AmplifyMotion.ObjectType.Skinned; } AmplifyMotionEffectBase.RegisterObject( this ); } } // No renderer? disable it, it is here just for adding children return ( renderer != null ); }