Closed Andrea332 closed 2 months ago
I presume the problem is when OnRectTransformDimensionsChange is called in the soft mask component
Hey, I have got the same issue in my project.
I have discovered that de-activating and re-activating a parent of the broken SoftMask GameObjects fix them.
So I have just made a dirty workaround with the following script. It simply de-activate and re-activate its own gameObject when a RectTransformDimensionsChange happen.
Of course you have to put this Script on a parent of the broken SoftMask GameObjects.
using UnityEngine;
[HelpURL("https://github.com/mob-sakai/SoftMaskForUGUI/issues/157#issuecomment-1691486145")]
public class ReActivateOnResize : MonoBehaviour {
void Start() { }
void OnRectTransformDimensionsChange() {
if(isActiveAndEnabled) {
gameObject.SetActive(false);
gameObject.SetActive(true);
}
}
}
This is not perfect:
Of course instead of using my script you can replace all default Unity Masks by SoftMasks, but in my case I prefer using SoftMasks only when necessary (to avoid putting SoftMaskable components everywhere).
I resolved this issue by adding
protected void OnRectTransformDimensionsChange()
{
OnValidate();
}
to SoftMaskable.cs
I have this strange problem when i'm using the unity default mask and the soft mask at the same time, for example when i change resolution of the game the soft mask and everything below it disappeard.
Steps to reproduce the behavior:
Using a unity default mask should not impact on other soft mask in the scene or prefab