Perhaps the simplest 2D animation is a simple flip, from facing left to facing right, or facing up to facing down, and so on. I personally use the transform rotation and rotate the player 180 deg about Y, but you have to adjust some cinemachine camera settings so it doesn’t screw with camera follower when you do that. Like others said, you can flip the x value of the local scale: var direction = 1 // or -1, depending which way you want the sprite pointing. unity sprite disappears when using transform. The Renderer also has a bool to flip on the y-axis. In there, locate the Sprites folder to find the Prototype Hero sprite. Code (CSharp): public class SpriteFlipper : MonoBehaviour. We assume that you already know how to add and set up 2D sprites. Unity flip sprite Mark it as sprite (2D and UI) as shown in the screenshot below.
0 Comments
Leave a Reply. |