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.

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.

Last updated