Nerd For Tech
Published in

Nerd For Tech

Calling the elevator

Now that we have the prerequisites out of the way, let’s get the elevator moving! If you’ve followed along with the moving platform scripts, this is going to be really familiar!

Let’s prepare our elevator by duplicating it, moving it down to where it should go and we’ll call it PointB, duplicate it again and call it PointA.

Since we only want the transform information, select both points and delete everything except the transform. Again I’m using the remove component option in the pulldown. Sorry for the cutoff window.

Next to keep things organized, create an empty called Elevator Holder and place the Elevator and Points in it.

And we’re ready to get things moving! Create a new script called Elevator and drag it into the Elevator object (Not the Elevator Holder).

Let’s create holders for PointA and PointB

Might as well throw a speed variable in as well. Now let’s drag the points into their proper slots.

We’ll want to know whether or not the elevator is going down so it’ll be a good idea to create a boolean for that.

Before we start writing any logic, let’s create a FixedUpdate that actually brings our elevator down to pointB. We’ll use the same method we learned in the moving platforms tutorial.

Let’s run the game:

Ok! Now we’re going places! Now we only want the elevator to move when we call it, our boolean _goingDown is already false, so let’s wrap it with that.

so now we need to create a connection to the elevator panel, we’ll create a method called ‘CallElevator’ where we’ll set _goingDown to true when it’s called.

Now let’s call it from our ElevatorPanel script!

Since we’re looking for a component outside of our script, it’s generally a good idea to null-check so if it isn’t found, it will notify us and we can do some debugging.

Ok, enough coding, let’s run this thing!

Awesome! We now have an elevator at our beck and call! But coming down is only half the battle, tomorrow we’ll complete the logic for it to go back up as well as fix anything that may come up.




NFT is an Educational Media House. Our mission is to bring the invaluable knowledge and experiences of experts from all over the world to the novice. To know more about us, visit

Recommended from Medium

how to add CORS to a dot net core web api

Making a Resume in HTML or React

Intro to Angular

Intro to Javascript + Tips for Success

Getting Started with React Router v6

Spring Websocket With SockJS Using Database MySql Or MariaDB + Html Javascript

Build a Sticky Navigation with Headroom.js

Our experience in development of SPA using VueJS + Nuxt

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Esteban Ibarra

Esteban Ibarra

cartoonist, game artist, and wanabe gamedev.

More from Medium

3rd Person Follow Virtual Camera Explained in Unity’s Cinemachine

Using Unity’s ProBuilder To Model A Sci-Fi Container

Magnetism in Unity Made Easy!

2.5D Phase1 Framework: Collectible