Core Concepts
There are some key structures that need to be understood in order to dive deep into the logic of the My Scene Manager.
Architecture
This is an overview of the My Scene Manager architecture. We will dive into each individual component in the next pages. Consider this flowchart:
- The
MySceneManageris a static implementation of aCoreSceneManager, which contains all the logic to perform Scene Operations. - The
CoreSceneManageris an implementation of theISceneManagerinterface, which defines four async methods:LoadAsync,UnloadAsync,TransitionAsyncandReloadActiveSceneAsync. A name, a build index, an address, anAssetReferenceor an array of any of them all reach the same method, becauseSceneParametersconverts from each. - The
SceneParametersstruct is an abstraction to handle a singleSceneRefor multiple (SceneRef[]), plus which one to activate. - The
SceneRefstruct is a reference to a scene. It is a single struct with aSceneRefKinddiscriminator rather than a family of types, which is what keeps build indices from boxing. - A bare string is a
Key, which theSceneRefResolversettles into a build index or an address before the operation runs. - The
SceneBackendRegistrypicks anISceneBackendfor each resolved kind — the standard Unity Scene Manager or Addressables — and the backend hands back aSceneBackendHandle. - The
SceneOperationPumpticks live handles on the player loop, which is what reports progress and resumes awaiters without aTaskround-trip. - Every operation returns a
SceneOperationimmediately, synchronously, as a live handle on the work. A completed one carries aSceneResult, that can hold a single or multiple scenes.
info
Scene Operations refer to the Load, Unload and Transition operations. A Reload operation is considered a Transition operation.
We will cover each of these structures in the next pages.
Coming from 4.x?
Three of these are new names for things you already know — SceneRef for ILoadSceneInfo, ISceneBackend for ISceneData, SceneOperation for the returned Task. The upgrade guide maps every method.
If you are new to the package, you can ignore that entirely.