2022. 1. 19. 17:39ㆍUnity3D/경험 기록
https://docs.unity3d.com/ScriptReference/SceneManagement.SceneManager.LoadSceneAsync.html
Unity - Scripting API: SceneManagement.SceneManager.LoadSceneAsync
You can provide the full Scene path, the path shown in the Build Settings window, or just the Scene name. If you only provide the Scene name, Unity loads the first Scene in the list that matches. If you have multiple Scenes with the same name but different
docs.unity3d.com
유니티 씬(Scene)과 씬 전환 (Scene Transition)
1. 씬 (Scene) 경찰, 범죄 등과 관련된 영화나 드라마를 보게 되면, Crime Scene이라는 노란색 테이프로 현장을 막아놓은 장면들이 나온다. 범죄에 사용된 물건, 사물 등이 존재하는 사건 현장이 씬이
notyu.tistory.com
보통 LoadScene을 하면
그 문장 이후의 코드는 실행 될 수 없다.
그러나 LoadSceneAsync는
씬을 로드 완료 한 뒤, 그 밑의 문장까지 실행 가능하게 해준다.
예시)
AsyncOperation asyncLoad = SceneManager.LoadSceneAsync("Scene2");
// Wait until the asynchronous scene fully loads
while (!asyncLoad.isDone)
{
yield return null;
}
예시2)
AsyncOperation operation = SceneManager.LoadSceneAsync("GameScene");
operation.completed += (oper) => {
GameMain gameMain = GameObject.FindObjectOfType<GameMain>();
gameMain.Init(prefabName);
'Unity3D > 경험 기록' 카테고리의 다른 글
애니메이션의 속도를 조절하고 싶을 때 (0) | 2022.01.20 |
---|---|
프리팹을 동적 생성 하고 싶을 때 (0) | 2022.01.19 |
public 이지만 인스펙터에서 감추고 싶을 때 (0) | 2022.01.19 |
구조체를 쓸 때 (0) | 2022.01.19 |
UI 버튼을 누른 상태를 유지하고 싶을 때 (0) | 2022.01.18 |