UnityEditor.ParticleEffectUI.InitializeIfNeeded C# (CSharp) Method

InitializeIfNeeded() public method

public InitializeIfNeeded ( ParticleSystem shuriken ) : bool
shuriken UnityEngine.ParticleSystem
return bool
        public bool InitializeIfNeeded(ParticleSystem shuriken)
        {
            ParticleSystem root = ParticleSystemEditorUtils.GetRoot(shuriken);
            if (root == null)
            {
                return false;
            }
            ParticleSystem[] particleSystems = GetParticleSystems(root);
            if ((root == this.GetRoot()) && (((this.m_ParticleSystemCurveEditor != null) && (this.m_Emitters != null)) && (particleSystems.Length == this.m_Emitters.Length)))
            {
                this.m_SelectedParticleSystem = shuriken;
                if (this.IsShowOnlySelectedMode())
                {
                    this.RefreshShowOnlySelected();
                }
                return false;
            }
            if (this.m_ParticleSystemCurveEditor != null)
            {
                this.Clear();
            }
            this.m_SelectedParticleSystem = shuriken;
            ParticleSystemEditorUtils.PerformCompleteResimulation();
            this.m_ParticleSystemCurveEditor = new ParticleSystemCurveEditor();
            this.m_ParticleSystemCurveEditor.Init();
            this.m_EmitterAreaWidth = EditorPrefs.GetFloat("ParticleSystemEmitterAreaWidth", k_MinEmitterAreaSize.x);
            this.m_CurveEditorAreaHeight = EditorPrefs.GetFloat("ParticleSystemCurveEditorAreaHeight", k_MinCurveAreaSize.y);
            this.InitAllEmitters(particleSystems);
            this.m_ShowOnlySelectedMode = (this.m_Owner is ParticleSystemWindow) && SessionState.GetBool("ShowSelected" + root.GetInstanceID(), false);
            if (this.IsShowOnlySelectedMode())
            {
                this.RefreshShowOnlySelected();
            }
            this.m_EmitterAreaScrollPos.x = SessionState.GetFloat("CurrentEmitterAreaScroll", 0f);
            if (this.ShouldManagePlaybackState(root))
            {
                Vector3 vector3 = SessionState.GetVector3("SimulationState" + root.GetInstanceID(), Vector3.zero);
                if (root.GetInstanceID() == ((int) vector3.x))
                {
                    float z = vector3.z;
                    if (z > 0f)
                    {
                        ParticleSystemEditorUtils.editorPlaybackTime = z;
                    }
                }
                this.Play();
            }
            return true;
        }

Usage Example

Exemplo n.º 1
0
        private void Init(bool forceInit)
        {
            IEnumerable <ParticleSystem> systems = from p in targets.OfType <ParticleSystem>() where (p != null) select p;

            if (systems == null || !systems.Any())
            {
                m_ParticleEffectUI = null;
                return;
            }

            if (m_ParticleEffectUI == null)
            {
                m_ParticleEffectUI = new ParticleEffectUI(this);
                m_ParticleEffectUI.InitializeIfNeeded(systems);
            }
            else if (forceInit)
            {
                m_ParticleEffectUI.InitializeIfNeeded(systems);
            }
        }
All Usage Examples Of UnityEditor.ParticleEffectUI::InitializeIfNeeded