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

Building My Own Git Server

Image by kreatikar (https://pixabay.com/users/kreatikar-8562930/) on pixabay.

How to use VeChain as a read-only-backend on all Browsers

Learn Android - Services in android

Cloud computing: This new tool from AWS could make life easier for developers

Cloud computing: This new tool from AWS could make life easier for developers

Non-Profit Client Management Software | Business Side of Non-Profits

Top 10 Most Popular GitHub Repos Leaderboard

Why Pseudo Code is Important

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

Unity Performance Optimization: Animation Module

WGTU #9: Diegetic VS non-diegetic learning— with World of Warcraft

Score Implementation

IWTV is part of Indy Pro ‘22