Cross-platform Input Controller

2D Mobile Game

Objective: Import and merge cross-platform input controller in the game

First of all, go to unity asset store and add the Standard Assets to your assets and sign in to the same g-mail in Unity.

Inside Unity, go to Windows>Package Manager and Import the Standard assets from the My Assets Package.

Now drag the Mobile Single Stick Controller to your scene from the package.

Add the UnityStandardAssets.CrossPlatformInput namespace to start implementing the crossplatforminput in the game.

Now create a gameobject variable and assign the joystick to the variable.

Add this script in replacing Input.GetButtonDown for player attack

Now replace the Input.GetKeyDown(KeyCode.Space) with above script to allow the player jump.

Finally replace Input.GetAxisRaw(“Horizontal”) with the above script to allow player movement.

And this is the final result.

--

--

--

Unity Developer

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Developers and the Rip Current Effect

How to Become an Active Block Producer or Council to Earn Revenue

So-Simple Walk-through

Let’s Learn: Functional Programming Pt 1

CS371p Fall 2021: Cameron Courtney: Final Entry

Crio cwod program

Distributed State Machines using Java Spring State Machine Framework

[*NEW*] Csv to Database NuGet Library.

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
Niraj Karki

Niraj Karki

Unity Developer

More from Medium

Loot System: Part Two — Enemy Loot!

Day 102: Character Animation Part 5

Textured Skyboxes (Standard, URP)

Cross-platform Input Controller in Unity