Rapid Prototyping w/ New Unity Input System

Richard Morgan
2 min readSep 8, 2022

--

Here’s a quick-and-clean example of a rapid prototype using the new Unity input system. Our goal is to create a player (cube) that can move around using the WASD keys, and fire a projectile with a cooldown. Ready, set, go…

First we need an input system:

Easy enough…

Next we need a Player Manager and a Player, with their own scripts:

And, lastly we’ll need a projectile prefab:

And now a bit of code… Let’s start with the projectile. It needs to move and destroy itself when it leaves the screen:

Next, our player needs to Move and Fire (after cooldown):

And finally, our Player Manager needs to initialize our input system and tell our Player when to Move and Fire:

And here’s all the script at a glance:

That’s it. In just a few minutes, with some very light code, we’re rockin’ a prototype!

--

--

Richard Morgan
Richard Morgan

Written by Richard Morgan

Unity developer interested in AI integrations.

No responses yet