2
\$\begingroup\$

I'm trying to change an Image's alpha through a legacy animation in Unity, so that it fades in and out in a loop. The animation works: I can see the color updated in realtime in the inspector. But the Image is not actually being updated. I know that it is possible this way, since changing the alpha manually in the inspector does change the opacity of the Image.

I could write a script for this, but would prefer to do it through an animation.

\$\endgroup\$
  • \$\begingroup\$ What shader are you using to render? \$\endgroup\$ – jgallant May 28 '15 at 13:10
  • \$\begingroup\$ @Jon As far as I know, Image does not have a shader. And I think I know what you're getting at. It's capable of using the alpha channel: I'm drawing a png with transparent regions. \$\endgroup\$ – Simon Verbeke May 28 '15 at 13:15
  • \$\begingroup\$ @Jon Aha, didn't think of that. But I'm not using any material, my Image is simply a Sprite. Changing the material to Sprite-Default doesn't work either. \$\endgroup\$ – Simon Verbeke May 28 '15 at 13:24
  • 1
    \$\begingroup\$ I tested this, and it works for me. I created a Canvas, then I created an Image, then I created an animation and set the Color value to alpha 0. Ran it, and the Image dissapears as expected. Can you post a screenshot of your setup maybe? i.imgur.com/W6uDMsf.gif \$\endgroup\$ – jgallant May 28 '15 at 13:38
  • \$\begingroup\$ @Jon Ah, but that's the new animation system, if I'm not mistaken. I'm using the legacy system. Guess I'll have to get familiar with that one then \$\endgroup\$ – Simon Verbeke May 28 '15 at 13:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.