UnityEngine.UI.MaskUtilities.NotifyStencilStateChanged C# (CSharp) Method

NotifyStencilStateChanged() public static method

Notify all IMaskable under the given component that they need to recalculate masking.

public static NotifyStencilStateChanged ( Component mask ) : void
mask UnityEngine.Component
return void
        public static void NotifyStencilStateChanged(Component mask)
        {
            List<Component> results = ListPool<Component>.Get();
            mask.GetComponentsInChildren<Component>(results);
            for (int i = 0; i < results.Count; i++)
            {
                if ((results[i] != null) && (results[i].gameObject != mask.gameObject))
                {
                    IMaskable maskable = results[i] as IMaskable;
                    if (maskable != null)
                    {
                        maskable.RecalculateMasking();
                    }
                }
            }
            ListPool<Component>.Release(results);
        }
    }

Usage Example

コード例 #1
0
ファイル: Mask.cs プロジェクト: BaseDorp/TankGame
        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;

                if (graphic is MaskableGraphic)
                {
                    (graphic as MaskableGraphic).isMaskingGraphic = false;
                }
            }

            StencilMaterial.Remove(m_MaskMaterial);
            m_MaskMaterial = null;
            StencilMaterial.Remove(m_UnmaskMaterial);
            m_UnmaskMaterial = null;

            MaskUtilities.NotifyStencilStateChanged(this);
        }
All Usage Examples Of UnityEngine.UI.MaskUtilities::NotifyStencilStateChanged