Change between Floors with Triggers

If instead of using vertical distance to know the closest floor where the player is, you can use triggers to change between floors. This can be used better for closed spaces levels, instead of opened.

For this, go to the Map Creator inspector, and in the floor that you need, open the Trigger To Change Floor list and press the Add Trigger button.

And like before, the gameObjects are created and attached to the proper hierarchy elements.

Like this, place this trigger where you want the map floor to be changed to Floor 0. This system is made to use two triggers for a zone, it means, one trigger to change to floor 0 and one trigger to change to floor 1 in every place the floors are changed, both of them close (for example, if the building has two stairs, to walk between both floors, there will be 4 triggers, two for every stair).

This can be appreciated here, in the demo mansion, there are two triggers in the stairs of the hall, one to change to Floor 1 and another for Floor 0. Also, a gizmo is used to show the link from every trigger to its floor.

Once the triggers are placed, go to the Map System inspector, go to Map Settings, and set to false the option Get Closest Floor To Player By Distance.

You can add as many triggers as you need for every floor. Also, you can remove any of these triggers with the X button and both the object in the scene and the list are removed.

Last updated