UnityEditor.SubModuleUI.IsChild C# (CSharp) Method

IsChild() static private method

static private IsChild ( ParticleSystem subEmitter, ParticleSystem root ) : bool
subEmitter UnityEngine.ParticleSystem
root UnityEngine.ParticleSystem
return bool
        internal static bool IsChild(ParticleSystem subEmitter, ParticleSystem root)
        {
            if ((subEmitter == null) || (root == null))
            {
                return false;
            }
            return (ParticleSystemEditorUtils.GetRoot(subEmitter) == root);
        }

Usage Example

示例#1
0
        private void CheckIfChild(Object subEmitter)
        {
            if (!(subEmitter != (Object)null))
            {
                return;
            }
            ParticleSystem root = this.m_ParticleSystemUI.m_ParticleEffectUI.GetRoot();

            if (SubModuleUI.IsChild(subEmitter as ParticleSystem, root) || !EditorUtility.DisplayDialog("Reparent GameObjects", string.Format("The assigned sub emitter is not a child of the current root particle system GameObject: '{0}' and is therefore NOT considered a part of the current effect. Do you want to reparent it?", (object)root.gameObject.name), "Yes, Reparent", "No"))
            {
                return;
            }
            if (EditorUtility.IsPersistent(subEmitter))
            {
                GameObject gameObject = Object.Instantiate(subEmitter) as GameObject;
                if (!((Object)gameObject != (Object)null))
                {
                    return;
                }
                gameObject.transform.parent        = this.m_ParticleSystemUI.m_ParticleSystem.transform;
                gameObject.transform.localPosition = Vector3.zero;
                gameObject.transform.localRotation = Quaternion.identity;
            }
            else
            {
                ParticleSystem particleSystem = subEmitter as ParticleSystem;
                if (!(bool)((Object)particleSystem))
                {
                    return;
                }
                Undo.SetTransformParent(this.m_ParticleSystemUI.m_ParticleSystem.transform, particleSystem.gameObject.transform.transform, "Reparent sub emitter");
            }
        }
All Usage Examples Of UnityEditor.SubModuleUI::IsChild