Upgrading Controls on a Forklift to the new Unity Input System

Now that we have our player moving with the new input system, let’s take a look at how we can go about adjusting the controls for a forklift within the same test area. What we will have to do is not only change the movement controls of the forklift, but the lifting mechanism will need to be updated as well.
To start, let’s quickly adjust the code we need for the movement of the forklift:

In order to change this to the new input system, we will repeat the process that we did with our player controls:

Once we have this code switched over to our new system, we can begin to test it within our game:

Now that we have our forklift moving, let’s get to work on being able to pick up that stack of pallets in the back.
Our code originally looked like this:

What I have done to be able to have it work with our new input system is taken the same movement processes, but applied them into a Coroutine:

In order to have our lift stay still upon the player letting go of the movement key, we have removed the speed at which the lift moves to nothing. Therefore, it will just stay in place. Finally, we will add in the coroutine to our lift and lower procedures:

Now that we have this all set up, let’s take a look at how this will look within our game:

There we have it. We have successfully adjusted our forklift to move and lift/lower a stack of pallets with the new input system. Next up, we will look at how we can go about flying around a drone.

--

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

How to Host Unity Games on the Web

Rendering Pages in Flask Using Jinja

Rendering Performance in Android - Overdraw

Gojowczyk — Giron (Live)”liveStream”

Exploring Kotlin Coroutines and Lifecycle Architectural Components integration on Android

Object Management for Managing your Objects — Listing, Moving, Deleting and More!

Compensating Transaction in Microservices

5 Programming Languages Marked for Death

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
Jordan Evans

Jordan Evans

More from Medium

Intro Physics with Unity

Drone Controls w/ New Unity Input System

Quick tip — How to set up Occlusion Culling in Unity

Daily Progression: Player Setup!