CREATE YOUR WORLD
Players & Characters: Tips

Changing ZEPETO character color and worn item color

8min

This guide aims to assist in creating engaging content.



Changing the Color of ZEPETO Characters

ZEPETO characters are instantiated at runtime as a ZepetoCharacter object.

If you inspect the structure of ZepetoCharacter, you'll find a sub-object named Zepeto Context. Further within Zepeto Context, there's another object named body.

By replacing the body(Clone) Material of the body Object at runtime using scripts, you can change the color of the ZEPETO character.

For non-animated avatars, this approach changes the color of the entire face and body.

Document image




However, for animated avatars, you need to also modify the body(Clone) Material of the ANIME_BASEMODEL, which is a child of the body Object.

Please note that Material replacements are feasible with Material arrays of the same length.

Document image






Below is a sample code that changes the body color of the Local Player.

Make sure to implement the logic so the character's color is changed only after the character has loaded.

TypeScript




Document image

  • Altering the body Material may result in the ZEPETO avatar's makeup not being displayed correctly.



Changing the Color of Worn Items

Worn items are instantiated as sub-objects under the body Object.

You can check the applied Material for each item from the Materials section of the item object.

By replacing the Materials at runtime using scripts, you can change the color of the items.

Document image




Below is a sample code that changes the color of the first item worn by the Local Player.

Ensure that the item's color is changed only after the character has loaded.

TypeScript




  • Code Explanation
    • this.body.transform.GetChild(0) refers to the first item among the worn items, i.e., the item at index 0.
    • You can adapt this to change the color of other worn items.
    • For items using multiple Materials, remember that Material replacements require Material arrays of the same length.
Document image




Changing the Color of Both ZEPETO Characters and All Items

By leveraging the insights we've gained so far, you can modify the color of both the character and all items uniformly.

Document image




Here's a sample code that alters the color of the Local Player's character and item colors entirely when the "Change Color" button is clicked and reverts back to the original when the "Original Color" button is clicked:

TypeScript




  • This method is not only applicable to the Local Player but also to any ZEPETO characters created at runtime, including NPC characters.
  • Feel free to get creative and apply it in fun ways!