Traveling To A New Scene
When you want to travel to a new scene you have to do it in a very specific manner. Luckily for you I have written all of that logic for you! If you, as a client, want to travel to a new scene you simply need to request the server to move you. To make this request you need to call the RequestJumpToScene function in the EMI_NetworkManager component.
Here is an example script of how you could do this via a trigger:
protected virtual void OnTriggerEnter(Collider col)
{
if (col.gameObject.layer == LayerMask.NameToLayer("Player"))
{
EMI_NetworkManager.instance.RequestJumpToScene(PointsUtil.PointType.JumpToPoint, "my-scene-name", "my-jump-point-name, "optional-team-name","optional-unload-scene");
}
}
The PointType are ANY gameobject that are tagged with the following:
PointsUtil.PointType.JumpToPoint = JumpPoint
PointsUtil.PointType.NetworkSpawnPoint = NetworkSpawnPoint
PointsUtil.PointType.RespawnPoint = NetworkRespawnPoint
The my-scene-name is the name of the Unity Scene to Jump to.
the my-jump-point-name is the name of the point name (with one of the appropriate above tags). This is case sensitive.
The optional-team-name is... well optional. If you want to jumpt to that point type with that name but only if that point has a Team component and that component has been set to be a member of optional-team-name.
The optional-unload-scene is also optional. If supplied will make the client unload that scene name when they have successfully loaded and transfered to the new scene name.