InitializeIfNeeded() public method

public InitializeIfNeeded ( ParticleSystem shuriken ) : bool
shuriken UnityEngine.ParticleSystem
return bool
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);
            }
        }
        void InitEffectUI()
        {
            if (!m_IsVisible)
            {
                return;
            }

            // Use locked particle system if set otherwise check selected gameobject
            ParticleSystem target = ParticleSystemEditorUtils.lockedParticleSystem;

            if (target == null && Selection.activeGameObject != null)
            {
                target = Selection.activeGameObject.GetComponent <ParticleSystem>();
            }

            m_Target = target;
            if (m_Target != null)
            {
                if (m_ParticleEffectUI == null)
                {
                    m_ParticleEffectUI = new ParticleEffectUI(this);
                }

                if (m_ParticleEffectUI.InitializeIfNeeded(new ParticleSystem[] { m_Target }))
                {
                    Repaint();
                }
            }

            // Cleanup if needed
            if (m_Target == null && m_ParticleEffectUI != null)
            {
                Clear();
                Repaint();
                SceneView.RepaintAll();
                PreviewEditorWindow.RepaintAll();
            }
        }