在Unity中,如何凍結一個場景中的屏幕,更改場景,然後在其他場景中解凍它?通過凍結屏幕,我只是表示它在凍結時不會更新。屏幕我只是這個意思:如何凍結屏幕?
我試過設置Time.timeScale = 0,但沒有奏效。
事情是我在場景中有不同的屏幕方向:第一個是肖像,第二個是風景。這會導致第二個場景扭曲/毀壞第一個場景中加載的加載屏幕。在第二個場景中初始化的東西需要橫向定位,所以我不能在所有東西都初始化後改變屏幕方向。
我只想在加載圖像加載後凍結屏幕,然後在第二個場景初始化後解凍屏幕。這可能嗎?
這是我的代碼的那一刻,廣義:
// Script for the first scene
class firstClass(){
IEnumerator ChangeScene(){
// Display loading screen in portrait orientation
loadingScreen.SetActive(true);
// Load the second scene
SceneManager.LoadSceneAsync("secondScene");
}
}
// Script for the second scene
class secondClass(){
Start(){
Screen.orientation = ScreenOrientation.LandscapeLeft; // twists the loading screen :(
Init(a lot of stuff) // Needs landscape orientation to be initialized properly
// Init done, hide loading screen
loadingScreen.SetActive(false);
}
}
這是我想要的工作:
class firstClass(){
IEnumerator ChangeScene(){
// Display loading screen in portrait orientation
loadingScreen.SetActive(true);
FreezeScreen();
SceneManager.LoadSceneAsync("secondScene");
}
}
class secondClass(){
Start(){
Screen.orientation = ScreenOrientation.LandscapeLeft; // doesn't affect the loading screen because the screen is frozen!
Init(a lot of stuff);
UnfreezeScreen();
// Init done, hide loading screen
loadingScreen.SetActive(false);
}
}
這裏有一個例證: https://gyazo.com/864303465be750b7970636415ddf070d
你是什麼意思凍結?你的意思是讓方向保持不變而不改變? – Programmer
是的,確切地說。即使改變屏幕方向,我也希望屏幕上顯示的內容保持不變。 – Johan
「凍結」屏幕的含義完全不清楚。你將不得不刪除這個詞。可能是你想***禁用旋轉***或許在你的加載過程中,只有***啓用旋轉***以後? – Fattie