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; } }
public bool Cut() { if (RopeParent != null) { return(RopeParent.CutNode(this.gameObject)); } else { DestroyUtils.DestroyImmediate(this.gameObject); } return(true); }
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; } }