Ejemplo n.º 1
0
        protected virtual void TryCreateCanvasAndGraphics()
        {
            Canvas v_canvasOptimizer = GetComponent <Canvas>();

            UnityEngine.UI.GraphicRaycaster v_graphicsRaycasting = GetComponent <UnityEngine.UI.GraphicRaycaster>();
            if (UseCanvasRaycasterOptimization && FullScreenRendering)
            {
                if (FullScreenRendering)
                {
                    if (v_canvasOptimizer == null)
                    {
                        v_canvasOptimizer = gameObject.AddComponent <Canvas>();
                    }
                    if (v_graphicsRaycasting == null)
                    {
                        v_graphicsRaycasting = gameObject.AddComponent <UnityEngine.UI.GraphicRaycaster>();
                    }
                }
            }
            else
            {
                if (v_graphicsRaycasting != null)
                {
                    DestroyUtils.Destroy(v_canvasOptimizer);
                }
                if (v_canvasOptimizer != null)
                {
                    DestroyUtils.DestroyImmediate(v_graphicsRaycasting);
                }
            }
        }
 private void CheckIfNeedUnloadAudio()
 {
     if (!string.IsNullOrEmpty(Error) && m_clip != null)
     {
         DestroyUtils.DestroyImmediate(m_clip);
         m_clip = null;
     }
 }
Ejemplo n.º 3
0
        public bool Cut()
        {
            if (RopeParent != null)
            {
                return(RopeParent.CutNode(this.gameObject));
            }
            else
            {
                DestroyUtils.DestroyImmediate(this.gameObject);
            }

            return(true);
        }
Ejemplo n.º 4
0
 private void CheckIfNeedUnloadImage()
 {
     if (!string.IsNullOrEmpty(Error) && (m_sprite != null || m_texture != null))
     {
         var v_texture = m_sprite != null? m_sprite.texture : null;
         //Destroy SpriteTexture
         if (v_texture != null)
         {
             DestroyUtils.DestroyImmediate(m_sprite.texture);
         }
         //Destroy Object Texture
         if (m_texture != null && !MarkedToDestroy.IsMarked(m_texture))
         {
             DestroyUtils.DestroyImmediate(m_texture);
         }
         if (m_sprite != null)
         {
             DestroyUtils.DestroyImmediate(m_sprite);
         }
         m_texture = null;
         m_sprite  = null;
     }
 }