- Home /
ArgumentException: Input Button right is not setup.
Whenever I try run a camera movement code:
using UnityEngine;
using System.Collections;
public class CameraMovement : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if (Input.GetButton ("right"));
{
transform.Translate(Vector2.right * 5 * Time.deltaTime);
}
}
}
I come up with this: ArgumentException: Input Button right is not setup. To change the input settings use: Edit -> Project Settings -> Input CameraMovement.Update () (at Assets/MyStuff/Scripts/Camera/CameraMovement.cs:12)
But horizontal axis is set as positive is right:
Plus in other cases the camera just moved without me pressing right arrow key.
Answer by DavidWatts · Sep 14, 2016 at 12:57 PM
The name of the button is actually "Horizontal" and it is set up as an axis so to use it you would call Input.GetAxis( "Horizontal" ) which returns a number with left being negative and right being positive. To get the right button call Input.GetKey( KeyCode.RightArrow );
Your answer
![](https://koobas.hobune.stream/wayback/20220612092803im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How to click and drag images into multiple slots? 0 Answers
2D Top Down SmokeBomb 0 Answers
2D Game: Best way to set player's Z? 1 Answer
Which Camera Rotation is Good While Making 2D Game? 0 Answers
Echolocation in 2D top down game 0 Answers