New Lift System

Timothy Janssen
3 min readSep 6, 2023

--

I have shown how to create an elevator that moves from one floor to another. Here, I will demonstrate how to make a lift that travels to multiple floors and pauses at each floor.

This is the lift setup that I will be using. It has three floors and a switch the player must use to activate the lift. Once activated the lift will continuously move between floors.

To start this feature I will create a script and set up the variables I need. I used a list so that the number of floors could be adjusted as needed without needing to modify the code.

In the start method I assign the current target to be the first element in the floor height list.

As with the other lift and moving platforms I add a collider to detect the player and make it a child of the lift. Then when the player leaves it sets the player’s parent to null.

Now I need to check if the lift is moving up or down. Then choose what floor to move to. This requires checking if the current index is out of range and adjusting accordingly. After the current index is set I will use it to assign the current target.

Next, I create the method used by the InputManager to activate the lift.

The last method I created is the IEnumerator to make it pause on each floor.

Okay, I said the previous method was the last one I created. This method is not technically created by me. I use the Fixed Update method to move the lift when it is active and the wait is over.

In the editor I will position the empty game objects and fill out the variables with the appropriate values.

Now it is time to test out the work.

It works as intended. Now it is your turn. Get out there and move some lifts!!!!

--

--