96.내일배움캠프 87일차 TIL <Unity Unity 2D 팀프로젝트- MartialGod:Reborn - 37일차> 08/12

정광훈(Unity_9기)·2025년 8월 12일

TIL (Today I Learned)

목록 보기
96/97
post-thumbnail

// 엔터를 누르면 다음 UI로 넘어가도록 함
yield return new WaitUntil(Enter);
yield return null;

new WaitUntil(true); 일 경우에만 다음 프레임부터 작업이 시작된다.
new WaitUntil(false); 일 경우에는 true가 될 때까지 대기한다.
yield return null;은 Enter가 2번 연속 눌리는 것을 막기위해 한 프레임 쉬게 해준다.


    private IEnumerator WaitForEnter()
    {
        if (tutorial == Tutorial.AttackTutorial)
        {
            tutorial_Attack1.SetActive(true);
            yield return new WaitUntil(Enter); // 엔터를 누르면 다음 UI로 넘어가도록 함
            yield return null;

            tutorial_Attack1.SetActive(false);
            tutorial_Attack2.SetActive(true);
            yield return new WaitUntil(Enter); // 엔터를 누르면 다음 UI로 넘어가도록 함
            yield return null;

            tutorial_Attack2.SetActive(false);
            tutorial_Repair.SetActive(true);
        }
        else
        {
            tutorial_SaveNode.SetActive(true);
        }

        // 엔터를 눌러 오브젝트 비활성화
        yield return new WaitUntil(Enter); 
        canvasGroup.DOFade(0f, 1f).OnComplete(Off);
    }

0개의 댓글