其程式如下:
using UnityEngine.UI;
using UnityEngine.SceneManagement;
public class NewBehaviourScript : MonoBehaviour {
private float startTime;
private float alpha = 1.0f;
[SerializeField]
private int m_time = 8;
[SerializeField]
private CanvasGroup m_canvasGroup;
// Use this for initialization
void Start () {
startTime = Time.time;
}
// Update is called once per frame
void FixedUpdate()
{
if (Time.time - startTime > m_time)
{
if (alpha > 0)
{
alpha -= 0.01f;
m_canvasGroup.alpha = alpha;
}
else
{
SceneManager.LoadScene("2", LoadSceneMode.Single);
}
}
}
}
沒有留言:
張貼留言