Metaverse Hub
Overview
The Hub scene is the multiplayer landing space.
The main purpose is to provide access to the others spaces (Art Gallery, PicaZoo, Music).
To do so, the scene contains portals that allow players to teleport to other spaces.
In the same was, the other scenes has a portal to come back to this hub.
Also, players can talk to each other if they are close to each other.
Portals
SpaceLoader activation
A SpaceLoader
(see the common "Joining another space" section) component is located on each portal.
During the Awake()
, it updates the portal text fields using the SpaceDescription
scriptable object parameter.
When a player enter on the portal platform, it start the "Exit" process to load the new scene.
C#
private void OnTriggerEnter(Collider other)
{
if (other.GetComponentInParent<HardwareHand>())
{
exitingTriggerCollider = other;
StartExiting();
}
}
The StartExiting()
method includes a protection agains unexpected scene loading.
Then it calls the actual scene switching with SwitchScene()
.