Frame-by-Frame Animation | 2D Animation | 4.0.1
docs.unity3d.com
    Show / Hide Table of Contents

    Frame-by-Frame Animation

    You can use Sprite Swap to quickly swap the Sprites rendered at run time, to create a frame-by-frame animation. This is useful for simple animations, such as to show a character blinking. It is recommended that you change the keyframe tangent setting in the Animation window first before following the workflow below:

    1. Place the Sprites for each animation frame in the Sprite Library Asset, and assign them all to the same Category. Give each Sprite a Label. Label names must be unique in their Category.

    2. Select your character Prefab, and bring it into the Scene.

    3. Open the Animation window, and select your character Prefab. and Select the Add Property button, and select the Sprite Resolver component’s Label property.

    4. Change the Label property at each keyframe in the Animation window in order of your Animation frames. This simulates a frame-by-frame animation style.

    Change the Keyframe Tangent

    When animating with the Category and Label value of the Sprite Resolver in the Animation window, it is important to change the keyframe’s tangent in the Animation window to Constant.

    This is because the Sprite Resolver component uses the defined string hash value to locate the desired Sprite. If the values between keyframe’s are interpolated, the Sprite Resolver will not be able to resolve to the correct Sprite.

    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023