Studio GuideWorld SDK Guide
Log In

Hello ZEPETOScript

You can use ZEPETOScript to implement game logic, control user input or modify the properties of characters and game objects.

ZEPETOScript is designed to support TypeScript programming language and is fully compatible with Unity MonoBehaviour interface.


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.

748

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

592

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.

733

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.

import { ZepetoScriptBehaviour } from 'ZEPETO.Script';

export default class NewTypescript extends ZepetoScriptBehaviour {

    Start() {    

    }

}

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

import { ZepetoScriptBehaviour } from 'ZEPETO.Script';

export default class HelloWorld extends ZepetoScriptBehaviour {

    Start() {
        console.log(`log : Hello World`);
        console.warn(`warn : Hello World`);
        console.error(`error : Hello World`);
    }

}

Check out the test code output screen below.

2476