- Home /
Syncing a sprite mask to an animated sprite renderer every frame
My character's sprite is animated by Unity's animations/animator system. I have added a wet skin feature, that when the player gets wet, I create a sprite mask matching the character's sprite and put a blue tint over it. In a coroutine that is called every frame, i match my sprite mask's sprite to my character's sprite, so that the blue tint matches the current silhouette of the character. However, when my character's sprite changes as per its animation, the sprite mask sprite doesn't change until another frame has passed.
I know I can add animation events, but I wanted my "wet skin" functionality to be able to match all kinds of units I've already made and that have animations, without having to go back thru and insert a bunch of animation events.
Perhaps LateUpdate would happen after the animation has swapped sprites? Any ways to know when the animator has swapped a sprite on the frame its swapped, instead of having to wait a frame?
p.s. How do I add line breaks to a post? I don't see any way to edit the html...? I just used the horizontal rule button.