Studio GuideWorld SDK Guide
Log In


A coroutine is a non-preemptive multitasking program component that works by pausing execution and then continuing where it left off. It is mainly used to execute such features such asynchronous operations, exceptions, event loops, iterators, infinite lists, and pipes.

Click here to learn more about Unity’s coroutine.



ZEPETOScript implementation of Unity coroutines as follows.

import { ZepetoScriptBehaviour } from 'ZEPETO.Script';
import { WaitForSeconds } from 'UnityEngine';

export default class Coroutine extends ZepetoScriptBehaviour {
    private current: number;
    Start() {
        this.current = 0;
        console.log(`start routine`);

    *DoRoutine() {
        while(true) {
            yield null;
            console.log(`[${this.current++}] Wait to next routine..`);
            yield new WaitForSeconds(1);

Check out the test code output screen below.