Nerd For Tech
Published in

Nerd For Tech

Unity Cross Platform Input

Objective: Use the Unity Standard Asset’s Cross Platform Input system.

So far, we’ve been creating our game for the Windows platform. But this is meant to be a mobile game. We can set the controls for mobile with the Standard Asset’s Cross Platform Input system!

First we have to include the CrossPlatformInput library in our Player script.

Now we’ll have to change our movement code to use the input system. The Cross Platform Input system won’t break our previous code.

We’ll do the same for our jump button…

…and the Attack button.

We must also make sure our button’s Button Handler scripts point to the correct axes. In our case, the Jump Button should point to Jump, while the Attack Button should point to Fire1. Now when we export our game to mobile, we’ll have touch controls!

--

--

--

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 https://www.nerdfortech.org/.

Recommended from Medium

Convert Multiple CSV Files into a Single XLSX Spreadsheet in Ruby

Redefining Open Source for the Data Center

Mac Shortcut For Crossing Out Text

Introducing CLI Resource Generators: NestJS CRUDin a eye blink.

How to convert PDF to Text TXT in PHP

The Not Invented Here Syndrome

‘Alexa — what’s on at The Royal Opera House?’

Why Choose MERN Stack Development For Your Startup?

Choose Mern Stack Development For Your Startup

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
Ryan Sweigart

Ryan Sweigart

An independent Unity Developer.

More from Medium

WGTU #10: Transhumanism— with Deus Ex

Destroying objects!!!

Lerp Squares — Part 2

What are Unity Skyboxes?