protected override void OnEnable() { base.OnEnable(); if (graphic != null) { graphic.canvasRenderer.hasPopInstruction = true; graphic.SetMaterialDirty(); } MaskUtilities.NotifyStencilStateChanged(this); }
protected override void OnValidate() { base.OnValidate(); if (!IsActive()) { return; } if (graphic != null) { graphic.SetMaterialDirty(); } MaskUtilities.NotifyStencilStateChanged(this); }
protected override void OnDisable() { // we call base OnDisable first here // as we need to have the IsActive return the // correct value when we notify the children // that the mask state has changed. base.OnDisable(); if (graphic != null) { graphic.SetMaterialDirty(); graphic.canvasRenderer.hasPopInstruction = false; graphic.canvasRenderer.popMaterialCount = 0; } StencilMaterial.Remove(m_MaskMaterial); m_MaskMaterial = null; StencilMaterial.Remove(m_UnmaskMaterial); m_UnmaskMaterial = null; MaskUtilities.NotifyStencilStateChanged(this); }