Skip to content

Instantly share code, notes, and snippets.

@todorok1
Created August 31, 2018 09:50
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save todorok1/975c6bae760df2643e9041de781c3bfc to your computer and use it in GitHub Desktop.
コルーチンの使用例
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CoroutineTest : MonoBehaviour {
void Start(){
// コルーチンを開始
StartCoroutine(DelayProcess(1.0f));
Debug.Log("コルーチンを起動しました。");
}
IEnumerator DelayProcess(float wait){
float startTime = Time.time;
Debug.Log("開始時刻は : " + startTime);
// 指定秒数待つ
yield return new WaitForSeconds(wait);
// デバッグ文の表示
float endTime = Time.time;
float diff = endTime - startTime;
Debug.Log("終了時刻は : " + endTime);
Debug.Log(diff + "秒待ってから処理されました。");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment