CREATE YOUR WORLD
Scripting

Coroutine

2min
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 📘 coroutine https //docs unity3d com/kr/current/manual/coroutines html https //docs unity3d com/kr/current/manual/coroutines html 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`); this startcoroutine(this doroutine()); } 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