Skip to content

Commit

Permalink
Merge pull request #60 from boraty14/patch-1
Browse files Browse the repository at this point in the history
Update README.md for Addressable Scene Parent Override
  • Loading branch information
gustavopsantos authored Aug 6, 2024
2 parents d46959b + adaaf45 commit 3d2665c
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,16 @@ If you want a scene to inherit services from another scene, you can use the `Ref
var bootScene = SceneManager.GetSceneByName("Boot");
var sessionScene = SceneManager.LoadScene("Session", new LoadSceneParameters(LoadSceneMode.Additive));
ReflexSceneManager.OverrideSceneParentContainer(scene: sessionScene, parent: bootScene.GetSceneContainer());

// Addessable Sample
// If you are loading an addressable scene, you need to load it with activeOnLoad parameter set to false
AsyncOperationHandle<SceneInstance> handle = Addressables.LoadSceneAsync("Session", LoadSceneMode.Additive, false);
await handle;

// after loading and setting the scene override then you should activate it
var bootScene = SceneManager.GetSceneByName("RootScene");
ReflexSceneManager.OverrideSceneParentContainer(scene: handle.Result.Scene, parent: bootScene.GetSceneContainer());
handle.Result.ActivateAsync();
```

By utilizing this API, you can create hierarchical structures such as the one shown below:
Expand Down

0 comments on commit 3d2665c

Please sign in to comment.