제목에 애니메이션이 재생되지 않는다고 표시되어 있습니다. 그 코드는 코 루틴에 있고 그 코드는 waitforseconds (3f) 전에있다.유니온 애니메이션 코 루틴에서 재생
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class Play : MonoBehaviour {
public Animator AnimatorRef;
// Use this for initialization
void Start() {
if (AnimatorRef == null)
{
AnimatorRef = GetComponent<Animator>();
}
}
public void PlayGame()
{
StartCoroutine(TitlePlay());
Debug.Log("playing");
}
IEnumerator TitlePlay()
{
Debug.Log("playing1");
AnimatorRef.SetBool("Enlarge", true);
yield return new WaitForSeconds(3f);
Debug.Log("playing2");
SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1);
}
}
애니메이터 참조를 잘 잡아서 3 개의 모든 주석이 표시됩니다.
그래서'PlayGame'에서 직접'AnimatorRef.SetBool ("Enlarge", true);를 호출하면 올바르게 작동한다고 말하는 겁니까? – UnholySheep