Quick Flow
Boot Scene은 모든 scene에 manager prefab을 중복 배치하는 대신, app-wide object를 한 번 만들고 ready를 확인한 뒤 다음 scene으로 넘어가는 진입점입니다. 작은 single-scene project에서는 필요 없지만 scene transition과 shared service가 늘면 lifecycle 기준점이 됩니다.
Boot Scene
-> duplicate boot guard
-> config / save / required asset load
-> app composition root 생성
-> ready 또는 failure 화면
-> target scene load
-> scene-local composition 후 gameplay start| 상황 | boot이 소유할 일 | 분리할 일 |
|---|---|---|
| 앱 최초 시작 | app scope 생성·config validation | combat/UI domain rule |
| target scene 진입 | load·retry·cancel·route | scene-local wiring detail |
| duplicate boot | reuse/fail/destroy policy | silent double initialization |
| scene 재시작 | persistent scope와 scene scope 구분 | 모든 manager의 영구화 |
초기화와 scene 진입을 나누기
bootstrapper는 save migration, settings, localization, required asset처럼 다음 scene이 시작하기 전 충족해야 하는 조건을 확인합니다. app root가 만든 shared service와 target scene의 HUD·spawner·presenter는 scope가 다르므로 boot object가 scene-local component를 오래 보관하지 않습니다. target scene은 load 뒤 별도의 scene composition에서 app contract를 받아 연결합니다.
SceneManager.sceneLoaded는 OnEnable 뒤 Start 전에 호출됩니다. 이 callback으로 scene entry injection을 한다면 entry component의 enable 상태와 dependency ready 조건을 함께 확인합니다. script execution order의 같은 값 사이 순서에 기대기보다, explicit initialize method 또는 ready signal로 순서를 드러냅니다.
중복과 실패
Build Settings의 첫 scene, deep link, test harness, additive load가 bootstrapper를 두 번 만들 수 있습니다. app root가 이미 존재하면 new object를 destroy하고 ongoing initialization을 재사용할지, explicit failure로 막을지 정책을 정합니다. DontDestroyOnLoad만 호출하고 duplicate를 방치하면 두 service가 event를 두 번 구독할 수 있습니다.
load failure, corrupted save, user cancel에서는 partial app graph가 남지 않게 cancel·dispose·retry owner를 boot scope에 둡니다. loading 중 target scene을 다시 누르면 previous request가 완료돼 화면을 되돌리는 race도 lifetime version으로 막습니다.
필요 여부 확인
scene이 하나이고 app service가 없으면 첫 scene entry의 간단한 initialization이 더 낫습니다. boot scene은 global manager를 더 만드는 이유가 아니라, shared initialization을 한 번만 실행하고 실패·재시도·전환 owner를 명확히 하는 이유가 있을 때만 둡니다.
Boot Scene은 거대 GameManager의 다른 이름이 아닙니다. 생성·ready·route·shutdown까지만 조정하고, 게임 규칙과 scene-specific UI를 직접 소유하지 않게 하세요.
참고 링크
2 sources