- Home /
2D CrossPlatformInput - AxisTouchButtons are not working?
Okey , so I want to add buttons to my pc game. My character is working fine with keyboard. I watched couple of videos about adding buttons. Later I created 2 buttons for left and right and added "AxisTouchButton.cs" script (from Standard Assets - Cross Platform Inputs) to these buttons ,set to horizontal settings -1 for left and +1 for right button. I also edited movement script that attached to player. But nothings is happening. What am i doing wrong?
//using System.Collections;
//using System.Collections.Generic;
//using UnityEngine;
//using UnityStandardAssets.CrossPlatformInput;
public class move : MonoBehaviour
{
float horizontal;
void Start()
{
}
void Update()
{
horizontal = CrossPlatformInputManager.GetAxis("Horizontal");
transform.Translate(Vector3.right * Time.deltaTime * 20.0f * horizontal);
}
}
Answer by varian_wrynn_logosh · Feb 02, 2019 at 08:11 PM
I figured out how to fix this issue. Dont forget to add "Editor" part when importing from standard assets. Importing only "Cross Platform Inputs" are not enough.
Answer by diliupg · Apr 17, 2019 at 02:30 PM
figured out how to fix this issue. Dont forget to add "Editor" part when importing from standard assets. Importing only "Cross Platform Inputs" are not enough.
What does the above mean? Where do you import?
Answer by Megaboy238 · Jan 24, 2021 at 12:05 PM
Try this tutorial it explains what to do and what is missing and where to find it. Built on Unity 2019.4 using Standard Assets ( Unity 2018.4) https://www.youtube.com/watch?v=O4zMQwr39CA
Your answer
Follow this Question
Related Questions
Unable to press UI buttons in the Editor in Dual Screen Mode?? 1 Answer
How to change the text of a button with a name from a list without the name repeating? 2 Answers
2D Sprites scaling to multiple screen sizes - Colliders, 2D Sprite image sizes, SpawnPoints 0 Answers
Detect if player wants to pause or to jump 3 Answers
Buttons stopped working after I temporarily changed the font. 1 Answer