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.