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"); } }
private void CheckIfChild(UnityEngine.Object subEmitter) { if (subEmitter != null) { ParticleSystem root = this.m_ParticleSystemUI.m_ParticleEffectUI.GetRoot(); if (SubModuleUI.IsChild(subEmitter as ParticleSystem, root)) { return; } 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 gameObject = UnityEngine.Object.Instantiate(subEmitter) as GameObject; if (gameObject != null) { 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 (particleSystem) { particleSystem.gameObject.transform.parent = this.m_ParticleSystemUI.m_ParticleSystem.transform; } } } } }
private bool CheckIfChild(UnityEngine.Object subEmitter) { ParticleSystem root = ParticleSystemEditorUtils.GetRoot(this.m_ParticleSystemUI.m_ParticleSystems[0]); ParticleSystem particleSystem = subEmitter as ParticleSystem; bool result; if (SubModuleUI.IsChild(particleSystem, root)) { result = true; } else { 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, Remove")) { if (EditorUtility.IsPersistent(subEmitter)) { GameObject gameObject = UnityEngine.Object.Instantiate(subEmitter) as GameObject; if (gameObject != null) { gameObject.transform.parent = this.m_ParticleSystemUI.m_ParticleSystems[0].transform; gameObject.transform.localPosition = Vector3.zero; gameObject.transform.localRotation = Quaternion.identity; } } else if (particleSystem != null) { Undo.SetTransformParent(particleSystem.gameObject.transform.transform, this.m_ParticleSystemUI.m_ParticleSystems[0].transform, "Reparent sub emitter"); } result = true; } else { if (particleSystem != null) { particleSystem.Clear(true); } result = false; } } return(result); }