簡體   English   中英

過渡后在SceneManager.LoadScene上顯示視頻播放器框架

[英]Video Player frame appearing after transition on SceneManager.LoadScene

我正在使用SceneManager.LoadScene加載使用Unity的新Video Player組件的場景。 鑒於在上一場景被破壞時360膠片上發生的瞬時停頓–我決定使用RawImage動畫作為從完全透明到黑色的過渡。 這掩蓋了問題,但在下一個視頻加載之前,緊接過渡之后和LoadScene(立即進行處理)之前,出現了上一個視頻的一幀。 解決該問題的任何方法將不勝感激! 與之相關的代碼如下:

sphere.GetComponent<VideoPlayer>().Pause();
rawImage.GetComponent<Animation> ().Play ("FadeOut");
yield return new WaitForSeconds (0.5f); //matches length of time of animation
SceneManager.LoadScene (scene_Name);

在此處輸入圖片說明

建議我在腳本中完成所有操作,但是使用下面的代碼,我遇到了完全相同的問題。

rawImage.GetComponent<RawImage> ().enabled = true;
sphere.GetComponent<VideoPlayer>().Pause();
for (int i = 0; i < 101; i++) {
    float transitionCounter = i / 100f;
    yield return new WaitForSeconds (0.0001f);
    Color temp = rawImage.GetComponent<RawImage> ().color;
    temp.a = transitionCounter;
    rawImage.GetComponent<RawImage> ().color = temp;
}
SceneManager.LoadScene (scene_Name);

謝謝!

終於解決了。 最簡單的解決方案是在從黑色開始的下一個場景中創建定時淡入。 這樣一來,看不到要傳送的幀。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM