SoftMaskForUGUI icon indicating copy to clipboard operation
SoftMaskForUGUI copied to clipboard

Images are not updated when alpha is changed by animation

Open marcelopapelgames opened this issue 3 years ago • 3 comments

I am using the SoftMask to fade in some UI Images. I added SoftMask to a parent object, where an Animation changes the value of alpha along the time. There are children objects with images and SoftMaskables that should "fade in" with the animation but nothing happens. It seems one value for alpha is used for rendering, the value is constantly updated - as seen in debug - but the images are not updated.

If I add code to update() method to verify changes in the alpha value and then call OnValidate(), the magic happens. I did for test purposes only.

https://youtu.be/XSFi4rIt_Z8

Version: Unity 2020

marcelopapelgames avatar Mar 26 '21 08:03 marcelopapelgames

I think I found a fix, by adding this to SoftMask.cs:

        protected override void OnDidApplyAnimationProperties()
        {
            hasChanged = true;
        }

marcelopapelgames avatar Mar 26 '21 08:03 marcelopapelgames

This helped my issue thanks! If there's a more proper way to do animations using softmask I'd like to know

KadynCBR avatar Jul 22 '22 03:07 KadynCBR

@marcelopapelgames

Thank you so much... I wasted hours on this problem.

But this fix completely eliminated my issue. thank you!

KimYC1223 avatar Sep 06 '23 17:09 KimYC1223