/// <summary> /// /// </summary> /// <param name="baseMaterial"></param> /// <returns></returns> public override Material GetModifiedMaterial(Material baseMaterial) { Material mat = baseMaterial; if (m_ShouldRecalculateStencil) { m_stencilID = TMP_MaterialManager.GetStencilID(gameObject); m_ShouldRecalculateStencil = false; } // Release masking material //if (m_MaskMaterial != null) // MaterialManager.ReleaseStencilMaterial(m_MaskMaterial); if (m_stencilID > 0) { mat = TMP_MaterialManager.GetStencilMaterial(baseMaterial, m_stencilID); if (m_MaskMaterial != null) { TMP_MaterialManager.ReleaseStencilMaterial(m_MaskMaterial); } m_MaskMaterial = mat; } return(mat); }
protected override void OnDisable() { //Debug.Log("*** SubObject OnDisable() ***"); //base.OnDisable(); //m_canvasRenderer.Clear(); //TMP_UpdateRegistry.UnRegisterCanvasElementForRebuild(this); if (canvasRenderer != null) { canvasRenderer.Clear(); } if (m_MaskMaterial != null) { TMP_MaterialManager.ReleaseStencilMaterial(m_MaskMaterial); m_MaskMaterial = null; } if (m_fallbackMaterial != null) { TMP_MaterialManager.ReleaseFallbackMaterial(m_fallbackMaterial); m_fallbackMaterial = null; } }
/// <summary> /// Function returning the modified material for masking if necessary. /// </summary> /// <param name="baseMaterial"></param> /// <returns></returns> public override Material GetModifiedMaterial(Material baseMaterial) { Material mat = baseMaterial; if (m_ShouldRecalculateStencil) { m_StencilValue = TMP_MaterialManager.GetStencilID(gameObject); m_ShouldRecalculateStencil = false; } if (m_StencilValue > 0) { mat = TMP_MaterialManager.GetStencilMaterial(baseMaterial, m_StencilValue); if (m_MaskMaterial != null) { TMP_MaterialManager.ReleaseStencilMaterial(m_MaskMaterial); } m_MaskMaterial = mat; } else if (m_MaskMaterial != null) { TMP_MaterialManager.ReleaseStencilMaterial(m_MaskMaterial); } return(mat); }
protected override void OnDestroy() { //Debug.Log("*** OnDestroy() ***"); // Destroy Mesh if (m_mesh != null) { DestroyImmediate(m_mesh); } if (m_MaskMaterial != null) { TMP_MaterialManager.ReleaseStencilMaterial(m_MaskMaterial); } if (m_fallbackMaterial != null) { TMP_MaterialManager.ReleaseFallbackMaterial(m_fallbackMaterial); m_fallbackMaterial = null; } #if UNITY_EDITOR // Unregister the event this object was listening to TMPro_EventManager.MATERIAL_PROPERTY_EVENT.Remove(ON_MATERIAL_PROPERTY_CHANGED); //TMPro_EventManager.FONT_PROPERTY_EVENT.Remove(ON_FONT_PROPERTY_CHANGED); //TMPro_EventManager.TEXTMESHPRO_PROPERTY_EVENT.Remove(ON_TEXTMESHPRO_PROPERTY_CHANGED); TMPro_EventManager.DRAG_AND_DROP_MATERIAL_EVENT.Remove(ON_DRAG_AND_DROP_MATERIAL); //TMPro_EventManager.TEXT_STYLE_PROPERTY_EVENT.Remove(ON_TEXT_STYLE_CHANGED); TMPro_EventManager.SPRITE_ASSET_PROPERTY_EVENT.Remove(ON_SPRITE_ASSET_PROPERTY_CHANGED); //TMPro_EventManager.TMP_SETTINGS_PROPERTY_EVENT.Remove(ON_TMP_SETTINGS_CHANGED); #endif m_isRegisteredForEvents = false; RecalculateClipping(); }
protected override void OnDisable() { TMP_UpdateRegistry.UnRegisterCanvasElementForRebuild(this); if (this.m_MaskMaterial != null) { TMP_MaterialManager.ReleaseStencilMaterial(this.m_MaskMaterial); this.m_MaskMaterial = null; } if (this.m_fallbackMaterial != null) { TMP_MaterialManager.ReleaseFallbackMaterial(this.m_fallbackMaterial); this.m_fallbackMaterial = null; } base.OnDisable(); }
protected override void OnDisable() { TMP_UpdateRegistry.UnRegisterCanvasElementForRebuild((ICanvasElement)(object)this); if (base.m_MaskMaterial != null) { TMP_MaterialManager.ReleaseStencilMaterial(base.m_MaskMaterial); base.m_MaskMaterial = null; } if (m_fallbackMaterial != null) { TMP_MaterialManager.ReleaseFallbackMaterial(m_fallbackMaterial); m_fallbackMaterial = null; } //((MaskableGraphic)this).OnDisable(); base.OnDisable(); }
protected override void OnDisable() { //Debug.Log("*** SubObject OnDisable() ***"); base.OnDisable(); if (m_MaskMaterial != null) { TMP_MaterialManager.ReleaseStencilMaterial(m_MaskMaterial); m_MaskMaterial = null; } if (m_fallbackMaterial != null) { TMP_MaterialManager.ReleaseFallbackMaterial(m_fallbackMaterial); m_fallbackMaterial = null; } }
protected override void OnDestroy() { if (this.m_mesh != null) { Object.DestroyImmediate(this.m_mesh); } if (this.m_MaskMaterial != null) { TMP_MaterialManager.ReleaseStencilMaterial(this.m_MaskMaterial); } if (this.m_fallbackMaterial != null) { TMP_MaterialManager.ReleaseFallbackMaterial(this.m_fallbackMaterial); this.m_fallbackMaterial = null; } this.m_isRegisteredForEvents = false; this.RecalculateClipping(); }
public override Material GetModifiedMaterial(Material baseMaterial) { Material material = baseMaterial; if (this.m_ShouldRecalculateStencil) { this.m_StencilValue = TMP_MaterialManager.GetStencilID(base.gameObject); this.m_ShouldRecalculateStencil = false; } if (this.m_StencilValue > 0) { material = TMP_MaterialManager.GetStencilMaterial(baseMaterial, this.m_StencilValue); if (this.m_MaskMaterial != null) { TMP_MaterialManager.ReleaseStencilMaterial(this.m_MaskMaterial); } this.m_MaskMaterial = material; } return(material); }
protected override void OnDestroy() { if (m_mesh != null) { UnityEngine.Object.DestroyImmediate(m_mesh); } if (base.m_MaskMaterial != null) { TMP_MaterialManager.ReleaseStencilMaterial(base.m_MaskMaterial); } if (m_fallbackMaterial != null) { TMP_MaterialManager.ReleaseFallbackMaterial(m_fallbackMaterial); m_fallbackMaterial = null; } TMPro_EventManager.MATERIAL_PROPERTY_EVENT.Remove(ON_MATERIAL_PROPERTY_CHANGED); TMPro_EventManager.FONT_PROPERTY_EVENT.Remove(ON_FONT_PROPERTY_CHANGED); TMPro_EventManager.DRAG_AND_DROP_MATERIAL_EVENT.Remove(ON_DRAG_AND_DROP_MATERIAL); TMPro_EventManager.SPRITE_ASSET_PROPERTY_EVENT.Remove(ON_SPRITE_ASSET_PROPERTY_CHANGED); m_isRegisteredForEvents = false; //((MaskableGraphic)this).RecalculateClipping(); RecalculateClipping(); }