UnityEditor.SubModuleUI.CheckIfChild C# (CSharp) Method

CheckIfChild() private method

private CheckIfChild ( Object subEmitter ) : void
subEmitter Object
return void
        private void CheckIfChild(Object subEmitter)
        {
            if (subEmitter != null)
            {
                ParticleSystem root = base.m_ParticleSystemUI.m_ParticleEffectUI.GetRoot();
                if (!IsChild(subEmitter as ParticleSystem, root))
                {
                    string message = 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?", root.gameObject.name);
                    if (EditorUtility.DisplayDialog("Reparent GameObjects", message, "Yes, Reparent", "No"))
                    {
                        if (EditorUtility.IsPersistent(subEmitter))
                        {
                            GameObject obj2 = Object.Instantiate(subEmitter) as GameObject;
                            if (obj2 != null)
                            {
                                obj2.transform.parent = base.m_ParticleSystemUI.m_ParticleSystem.transform;
                                obj2.transform.localPosition = Vector3.zero;
                                obj2.transform.localRotation = Quaternion.identity;
                            }
                        }
                        else
                        {
                            ParticleSystem system2 = subEmitter as ParticleSystem;
                            if (system2 != null)
                            {
                                Undo.SetTransformParent(system2.gameObject.transform.transform, base.m_ParticleSystemUI.m_ParticleSystem.transform, "Reparent sub emitter");
                            }
                        }
                    }
                }
            }
        }