반응형
코드 작성
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class Example : MonoBehaviour
{
private void Start()
{
StartCoroutine(ExampleCoroutine());
StartCoroutine(Example2Coroutine());
StopAllCoroutine(); //모든 코루틴 정지
}
IEnumerator ExampleCoroutine()
{
Debug.Log("코루틴 실행중");
yield return new WaitForSeconds(1f);
StartCoroutine(ExampleCoroutine());
}
IEnumerator Example2Coroutine()
{
while(true)
{
Debug.Log("코루틴을 While문에서 실행중");
yield return new WaitForSeconds(1f);
}
}
}
참고할만한 글
반응형
'개발 > C#' 카테고리의 다른 글
유니티 C# 구글 스프레드 시트 Google Sheet 간단 사용법 (0) | 2022.07.13 |
---|---|
유니티 C# 오디오 Audio Source , Audio Clip 간단 사용법 (0) | 2022.07.06 |
유니티 C# 카메라 흔들기 Camera Shake 간단 사용법 (0) | 2022.07.06 |
유니티 C# 시간 DateTime 출력하기 간단 사용법 (0) | 2022.07.06 |
유니티 C# 스킬 쿨타임 구현 FillAmount 간단 사용법 (0) | 2022.07.06 |
유니티 C# 자석 효과 Magnet 간단 구현 (0) | 2022.07.06 |
유니티 C# 일시정지 Pause 구현하기 간단 사용법 (0) | 2022.07.06 |
유니티 C# 화면 터치 드래그 Touch Drag 간단 사용법 (0) | 2022.07.06 |
댓글