CREATE YOUR WORLD
Scripting

Hello ZEPETOScript

12min

What is ZEPETOScript?

  • ZEPETOScript is a scripting language used for creating ZEPETO World.
  • It supports the TypeScript programming language.
  • ZEPETOScript is designed to define behaviors and functionalities within ZEPETO World, including:
    • Movement, physics, and interactions of objects.
    • Handling events, including user inputs.
  • Inherits from the ZepetoScriptBehaviour class, designed to be compatible with Unity's MonoBehaviour interface.
  • It can be attached to active GameObjects in the scene for execution.

❗️ Caution

  • When developing for ZEPETO World, C# scripts are not included in the package build.
  • Make sure to only implement using ZEPETOScript.

Hello World Tutorial

STEP 1 : Creating a ZEPETOScript

To create a new ZEPETOScript file,

click [Project] and select the [+] icon in the top left corner of the panel, or click Assets → Create → ZEPETO → TypeScript.

Document image




You can see that a new ZEPETOScript has been created, as shown below.

Document image




STEP 2 : Adding ZEPETOScript to a GameObject

ZEPETOScript can be attached to a GameObject as a Component, simply drag and drop the ZEPETOScript file onto the GameObject.

Document image


👍 TIP

  • You can add components through the Add Component > Zepeto Script option.

STEP 3 : Adding test codes or emitting logs

The newly generated ZEPETOScript is shown below. You can edit the script using Unity’s development tools.

NewTypescript




Try adding log codes within the Start function to test whether the ZEPETOScript moves.

HelloWorld




Check out the test code output screen below.

Document image




Congratulations on completing the ZEPETOScript tutorial!

For those who have previously developed with C# in Unity or those new to ZEPETO World development, let's dive into the basics of ZEPETOScript.



Declaring Variables in ZEPETOScript

  • ZEPETOScript follows TypeScript syntax.
  • Therefore, it is essential to declare the type when declaring a variable.
  • Example of variable declaration:
TypeScript




Using Map Data Type

  • Instead of C#'s Dictionary data type, use TypeScript's Map data type to store and manage key-value pairs.
  • This data type is especially convenient for managing player data when implementing a multiplayer world.
  • Simple usage example of Map:
TypeScript




Utilizing JSON

When working with JSON-formatted data, you can use TypeScript's built-in functions.

  • Converting a JSON string to an object
    • Use the JSON.parse() method.
  • Converting an object to a JSON string
    • Use the JSON.stringify() method.
  • Example of utilizing JSON:
TypeScript






Updated 10 Oct 2024
Doc contributor
Did this page help you?