using UnityEngine; using UnityEngine.UI; namespace SoftMasking.Samples { public class SoftMaskToggler : MonoBehaviour { public GameObject mask; public bool doNotTouchImage = false; public void Toggle(bool enabled) { if (mask) { mask.GetComponent().enabled = enabled; mask.GetComponent().enabled = !enabled; if (!doNotTouchImage) mask.GetComponent().enabled = !enabled; } } } }