H
H
HoloFair SDK V2
Search…
⌃K

Portals

To trigger scene loading or unloading you will need a Collider with Is Trigger set to true and 2 components on it: OnTriggerHandler and SceneController. OnTriggerHandler should expect a tag LocalPlayer. Then make sure to have a scene added as addressable asset in your addressable group, so that you can open the addressable group and drag and drop the asset into the scene variable on SceneController. Once done, OnTriggerHandler add 2 listeners for On Enter and On Exit events. In both drag and drop the gameObject with SceneController. In the dropdown of functions of event On Enter choose SceneController.TryToLoadNext which will trigger scene loading. The same for On Exit, but instead SceneController.TryToUnloadNext. After that, you gameObject with components should be similar to the one on the image below:
Each created portal must be a child of empty gameObject, which Transform is reseted (position = 0,0,0, rotation = 0,0,0, scale = 1,1,1). Then the gameObject must be saved as prefab and then later marked as addressables. See the video below which shows how such prefab is prepared:
It also contains part of WorldSettings preparation that will help to understand the next page.
In the video a mistake was made in the last part. Note that Portals prefab was left by accident in the scene, which actually was supposed to be deleted. In other words, NEVER LEAVE THE PORTALS PREFAB IN A SCENE LIKE THIS. Otherwise, it will recursively load the same scene and crash the project at some point.
After setting up the portals the project is pretty much ready for deployment and testing. So, before making the first build of addressables, you need to create and configure an asset called WorldSettings, which is explained on the next page.