Hello 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.
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.
You can see that a new ZEPETOScript has been created, as shown below.
ZEPETOScript can be attached to a GameObject as a Component, simply drag and drop the ZEPETOScript file onto the GameObject.
👍 TIP
- You can add components through the Add Component > Zepeto Script option.
The newly generated ZEPETOScript is shown below. You can edit the script using Unity’s development tools.
Try adding log codes within the Start function to test whether the ZEPETOScript moves.
Check out the test code output screen below.
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.
- ZEPETOScript follows TypeScript syntax.
- Therefore, it is essential to declare the type when declaring a variable.
- Example of variable declaration:
- 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:
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:
- For more detailed syntax, please refer to the TypeScript Docs