Crossplatform Input Controller made Easy!

Going to be another short article but this will be about the simple method to adding basic touch controls to your game!

First off we will be using “CrossplatformInput” from the Standard Assets package on the Unity Store. This is now outdated, however we can still use what we need.

What we end up needing to do is simply find our prefab and just drag it into the hierarchy (after replacing the image associated first of course)! Now its time to get to some coding.

First we cannot forget to add the CrossPlatformInput library. Afterwards it is as simple as instead of using Input.GetKeyDown or Axis, we use “CrossPlatformInputManager.GetAxis” and “GetButtonDown”.

With that we have working touch controls that we can test in the editor! If I were to make touch controls from scratch, that would be an enormous task that I am definitely not ready for. It is great that the store has assets like this to make things a little easier!

See you next post!

--

--

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