This bug has riddled out app with unexpected behavior with all of our components which contain a Rect Mask 2d. We often instantiate a Scroll View game object off screen, then slide it on screen. Doing so however seems to break the Rect Mask 2d expected behavior, and the masks often don’t work, and further sliding animations stop working.
One slight workaround that works in some cases is to wait to activate the Rect Mask 2d until it is on screen fully.
public class BodyMaskActivator : MonoBehaviour
{
public UnityEvent maskActivated;
public bool isUnmasked = true;
void Start()
{
StartCoroutine(WaitThenActivate());
}
IEnumerator WaitThenActivate()
{
yield return new WaitForSeconds(.7f);
if (this.GetComponent<RectMask2D>())
{
this.GetComponent<RectMask2D>().enabled = true;
maskActivated.Invoke();
isUnmasked = false;
}
}
}
However, this is inconsistent and in many cases, waiting .7f seconds to activate the mask causes all the unwanted hidden masked objects to show until the script is activated.
Has anyone experienced this issue? Any info on a possible workaround and fix would hugely help us move forward with polishing off our UI and launching our app.
Thank you Unity community. We are currently using version 2019.4.8f1