Sprite Swap manual setup | 2D Animation | 4.1.1
docs.unity3d.com
    Show / Hide Table of Contents

    Sprite Swap manual setup

    When a Category or Label is created from the Sprite Visibility panel in the Skinning Editor, Unity automatically generates a Sprite Library Asset as a sub-Asset of the character Prefab that contains the Categories and Labels created for that Prefab.

    You can create a Sprite Library Asset manually and choose which GameObject refers to it, by following the steps below:

    1. Select the Sprite Library Asset from the Asset creation menu by going to: Asset > Create > Sprite Library Asset.

    2. Select the new Sprite Library Asset and go to its Inspector window. The list of Categories and Labels available in the Asset is displayed.

    3. Select Add (+) at the bottom-right of the List to add a new Category. Enter a name into the ‘New Category’ box. Each Category in the same Sprite Library Asset must have a name unique from others.

    4. Next, create an empty GameObject (menu: Right-click on the Hierarchy window > Create Empty). Select it and then add the Sprite Renderer component to it.

    5. Add the Sprite Library component to the same GameObject. Assign the Sprite Library Asset created in step 3 to the Sprite Library Asset box.

    6. Add the Sprite Resolver component to the same GameObject.

      Open the Category drop-down menu, and select a Category you created in step 3. The component will then display a Label drop-down menu and a Visual Variant Selector that displays thumbnails of the different Sprites available in the Category.

    7. When you select a Sprite in the Sprite Resolver component, Unity automatically replaces the current Sprite in the Sprite Renderer component with the one you have selected.

    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