I’m looking for a way to animate sprites in the Canvas. My understanding is that it’s not possible to use the Sprite Renderer with the Canvas, which is how we are animating sprites in our game currently. Is there a way to make our animations show up and play in the Canvas?
Depends on how you want to animate them, is this a sprite sequences? or are you animating slices?
If its a sprite sequence you can animate it using an image instead of a sprite renderer in the exact same way you are used to, though there appears to be some scaling issues with sequences that use cells of different sizes
Looks like you can get it to work just fine using an Image as you said. You just have to change over your animations to animate with Image.Sprite instead of Sprite. Since we were initially using a Sprite Renderer for our animations, all of them were set as animating via Sprite. To convert it over to Image.Sprite, it seems all you have to do is set up your object with the Animator and Image then go into the you need to convert Animation, delete the Sprite animation and then simply drag back in the animation frames back into the animation which will set them up to animate as Image.Sprite which works with the Image component.
The last little gotcha is to make sure you check off the “Preserver Aspect” checkbox on the Image component. This is essential if you are using a sprite sheet with sprites that have been sliced in various different sizes. If you don’t do this, it will scale each frame of the animation to take up the whole Rect allotted for the image which will look bad.
To anyone else who had problem with understanding these instructions, they do work but one word is missing:
To convert it over to Image.Sprite, it seems all you have to do is set up your object with the Animator and Image then go into the Animation window (Ctrl + 6), you need to convert Animation, delete the Sprite animation and then simply drag back in the animation frames back into the animation which will set them up to animate as Image.Sprite which works with the Image component.
Also, it looks like you can remove the Sprite Renderer from the image gameobject afterwards.
To convert it over to Image.Sprite, it seems all you have to do is set up your object with the Animator and Image - ok done that.
“you need to convert Animation, delete the Sprite animation and then simply drag back in the animation frames back into the animation which will set them up to animate as Image.Sprite which works with the Image component.” - this i just dont get, please help
Hey man this might be a bit late but basically, double click the animation clip, then DELETE the sprite in the animation pane. Then highlight ALL of the images in your animation image, and drag them to the timeline. This will make a image.sprite animation and it’ll work in the UI now.