CREATE YOUR WORLD
Scripting

Coroutine

2min
코루틴은 실행을 일시 중지한 다음 중단된 지점에서 계속 진행하는 비선점 멀티태스킹 프로그램 구성 요소입니다 주로 비동기 작업, 예외, 이벤트 루프, 반복자, 무한 목록 및 파이프와 같은 기능을 실행하는 데 사용됩니다 여기를 클릭하여 unity의 코루틴에 대해 더 알아보세요 📘 코루틴 https //docs unity3d com/kr/current/manual/coroutines html https //docs unity3d com/kr/current/manual/coroutines html unity 코루틴의 zepeto 스크립트 구현은 다음과 같습니다 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); } } } 아래의 테스트 코드 출력 화면을 확인하세요