docs.unity3d.com
    Show / Hide Table of Contents

    Changing Parts of a Character

    You can use Sprite Swap to quickly change only one Sprite on the character Prefab without affecting the other Sprites. This means you can alter part of a character’s appearance (for example, change a scarf to a different color) while the rest of the character remains the same.

    In the following example, we have two Sprites that are variations of the character’s scarf - one green and one blue. This workflow demonstrates how to switch from one to the other in the same Prefab.


    Left: The original green scarf. Right: An alternate blue scarf.

    1. Place the Sprites for both scarves into the same Sprite Library Asset, and add them both to the same Category named ‘Scarf’. You can do this directly in the Skinning Editor via the Sprite tab in the Sprite Visibility panel.

    2. Give each of the Sprites a unique Label.

    3. In the Scene, select the character Prefab and then select the ‘Scarf’ GameObject the Hierarchy window.

    4. Go to the Sprite Resolver component of the ‘Scarf’ GameObject. The Sprite Resolver‘s visual selector displays the two Sprites available in the ‘Scarf’ Category.

    5. Select the ‘blue scarf’ to switch the Sprite rendered by the ‘Scarf’ GameObject to it instead.


      Sprite Resolver’s Label set to ‘blue scarf’.

    Back to top
    Terms of use
    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