Sitemap

Upgrading Drone Controls from Legacy Input to the new Input System

New Input System Framework

6 min readJun 27, 2025

--

Objective: Learn how to upgrade your drone controls from Unity’s Legacy Input System to the New Input System.
This tutorial is part of the
Software Engineering Framework developed by Game Dev HQ.

We’ll jump straight into upgrading the existing drone control code. If you’re new to the New Input System, check out these helpful resources first

💡 Need help setting up Input Actions Scripts? [Click here]
💡
New to the Input System? [Start here].

Additional links will be provided throughout the article to support you as needed.

Table of Contents

· EnablingDrone Input
· Disabling Drone Input
· Update Logic — Rotation
Refactoring for the New Input System:
· Calculating Drone Tilt
Refactored for the New Input System:
Tilt Movement Result
· Fixed Update Logic — Vertical Movement
Refactored Logic
Up and Down Movement Result

EnablingDrone Input

Initializing Action Maps

Drone controls can be complex, so we’ll take it step-by-step. Unlike our player controller upgrade, drone input must be initialized directly within the drone script, since we’re toggling between player mode and drone mode dynamically.

Press enter or click to view image in full size

🔍Code Highlights

  • The EnterFlightMode() method is responsible for switching control from the player to the drone.
  • This is the ideal place to initialize drone-specific input using the New Input System.
  • (We’ll cover interactable zone logic in a separate article.)

Initialize Drone Input in the Input Manager

All input logic is handled in a centralized Input Manager Script. This keeps things modular and clean.

💡 Want to learn more? Check out:
The Best Way to Organize Input Scripts

Press enter or click to view image in full size

🔍Code Breakdown

  • We create a public method in the Input Manager that handles drone input initialization.
  • The player input is disabled through the Input Actions reference.
  • The drone input is then enabled from the same reference.
  • Reference the Input Manager object in the Drone Script through the Inspector.
  • Finally, call this method inside the drone’s EnterFlightMode() method.
Press enter or click to view image in full size

Disabling Drone Input

When exiting drone mode, we’ll want to re-enable player controls and disable drone input.

Press enter or click to view image in full size

The starter code already has an method to handle this, so it should follow the same logic as theEnterFlightMode() method.

Press enter or click to view image in full size
  • Create a separate public method in the Input Manager to disable drone input.
  • Call this method in the ExitFlightMode() method within the drone script.
  • This mirrors our initialization process and keeps logic cleanly separated.
Press enter or click to view image in full size

Update Logic — Rotation

Drone movement consists of rotation (handled in Update()) and physics-based movement (handled in FixedUpdate()).

Press enter or click to view image in full size

🔍Original Code Observation:

  • Rotation is manually calculated per key (e.g., left/right arrow).
  • A temporary rotation variable (tempRot) stores euler angles.
  • Left rotation subtracts from the Y-axis; right adds to it.

With the new unity input system, we don’t need to hard code this rotational values, instead we can use a context variable, and reduce this bulk of code to a few lines.

Refactoring for the New Input System:

Press enter or click to view image in full size

🔍Code Breakdown

  • Create a public method in the Drone Script for rotation.
  • Add a float rotInput parameter, which will hold the input value from the Input Manager.
  • Use the rotInput value to apply rotation dynamically based on input.
  • Update the local rotation with transform.localRotation.

By refactoring our code, we significantly reduce the bulk of it as we no longer need to hard-code movement logic per-key.

Registering Rotation Input

In the Input Manager’s Update() method, we’ll register the rotation input:

Press enter or click to view image in full size

🔍Code Breakdown

  • Create a float rotInput variable to match the Drone’s CalculateRotation(rotInput) method.
  • Use a 1D Axis Input Map (left = -1, right = 1).
  • Use ReadValue<float>() to read the live input value.
  • Pass it into the Drone’s method to apply rotation in real-time.

Rotation Movement Result

Press enter or click to view image in full size

Calculating Drone Tilt

Like rotation, tilt was previously handled through repetitive code for each key.

Press enter or click to view image in full size

🔍Original Code Observation

  • Tilts the drone using fixed 30-degree rotations for WASD keys.
  • Each direction required its own manual input logic.

💡If you need help setting up a WASD(Vector 2) Action Map click [here].

Refactored for the New Input System:

Press enter or click to view image in full size

🔍Code Breakdown

  • Change the tilt method to public
  • Add a Vector2 tiltInput parameter to match WASD directional input
  • Use the tilt input to calculate and apply a consistent 30-degree tilt in the appropriate direction.

Registering Tilt Input

n the Input Manager’s Update() method.

Press enter or click to view image in full size

🔍Code Breakdown

  • Create a Vector2 tiltInput variable to match the CalculateTilt(Vector2 tilt) method.
  • Use ReadValue<Vector2>() to capture live directional input.
  • Pass this into the Drone’s tilt logic for smooth control.

Tilt Movement Result

Press enter or click to view image in full size

Fixed Update Logic — Vertical Movement

Vertical movement (up and down) is handled through physics in FixedUpdate().

Press enter or click to view image in full size

🔍Original Code Observation:

  • Uses Rigidbody.AddForce() with ForceMode.Acceleration.
  • Direction is set manually for each key (e.g., up arrow = transform.up, down arrow = -transform.up).
  • Movement depends on direction and speed.

Refactored Logic:

The code can be reduced to a single line.

Press enter or click to view image in full size

🔍Code Breakdown

  • Change the method to public so it can be accessed by the Input Manager.
  • Add a float direction parameter to determine movement direction from input.
  • Use a 1D Axis Input Map (up = 1, down = -1).
  • Apply a single force line using the direction variable and ForceMode.Acceleratio

Registering Vertical Movement Input

In the Input Manager’s FixedUpdate() method:

Press enter or click to view image in full size

🔍Code Breakdown

  • Create a float direction variable to match the drone's vertical movement method.
  • Add a condition to check if the input is not zero (i.e., -1 or 1).
  • If valid, call the drone’s method and apply the directional force (optionally invert the direction if needed)

Up and Down Movement Result

Press enter or click to view image in full size

Your drone input is now modular, optimized, and future-proof!

✅Clean separation between input logic (Input Manager) and drone behavior (Drone Script)

✅ Refactored methods that are scalable, readable, and easy to manage

✅ A fully functional drone controller powered by Unity’s New Input System

Thanks for reading!

If you found this guide helpful, feel free to check out [my portfolio] or follow me — I’m currently open to opportunities in the video game industry! 😊

--

--

Dennisse Pagán Dávila
Dennisse Pagán Dávila

Written by Dennisse Pagán Dávila

Software Engineer that specializes in Game Development. Currently looking for new opportunities. Portfolio: dennissepagan.com

No responses yet