激活触发器后,面板应淡入,然后应加载新场景。不幸的是,这些事情中只有一种发生。
我希望一个接一个发生。
public void transitionpef()
{
StartCoroutine(panelfadewhite());
}
public IEnumerator panelfadewhite()
{
float ElapsedTime = 0f;
float TotalTime = 2f;
while (ElapsedTime < TotalTime)
{
ElapsedTime += Time.deltaTime;
panel.color = Color.Lerp(new Color(1.0f, 1.0f, 1.0f, 0), new Color(1.0f, 1.0f, 1.0f, 1), (ElapsedTime / TotalTime));
yield return new WaitForSeconds(3);
SceneManager.LoadScene("selection_ui", LoadSceneMode.Single);
yield return null;
}
}
答案 0 :(得分:3)
看起来您的退货错误了。试试这个:
public IEnumerator panelfadewhite()
{
float ElapsedTime = 0f;
float TotalTime = 2f;
while (ElapsedTime < TotalTime)
{
ElapsedTime += Time.deltaTime;
panel.color = Color.Lerp(new Color(1.0f, 1.0f, 1.0f, 0), new Color(1.0f, 1.0f, 1.0f, 1), (ElapsedTime / TotalTime));
yield return null;
}
yield return new WaitForSeconds(3);
SceneManager.LoadScene("selection_ui", LoadSceneMode.Single);
yield return null;
}