Input axis horizontal is not setup ошибка как исправить

Даниил Евсеев



Ученик

(90),
закрыт



1 год назад

Подскажите пожалуйсто что ну жно выбрать так как после запуска игры ничего не изменяется и ошибка ArgumentException: Input Axis Horisontal is not setup.
To change the input settings use: Edit -> Settings -> Input остаётсяё

Arman Arutyunov

I’ve received an error:
ArgumentException: Input Axis Horizantal is not setup. To change the input settings use: Edit -> Project Settings -> Input PlayerMovement.Update () (at Assets/Scripts/PlayerMovement.cs:18)

Have no idea why because I retyped everything pretty accurately in code like hundred times! Maybe anyone could find a mistake?

using UnityEngine;
using System.Collections;

public class PlayerMovement : MonoBehaviour {

    private Animator playerAnimator;
    private float moveHorizontal;
    private float moveVertical;
    private Vector3 movement;

    // Use this for initialization
    void Start () {
        playerAnimator = GetComponent<Animator> ();
    }

    // Update is called once per frame
    void Update () {
        moveHorizontal = Input.GetAxisRaw ("Horizontal");
        moveVertical = Input.GetAxisRaw ("Vertical");

        movement = new Vector3 (moveHorizontal, 0.0f, moveVertical);
    }

    void FixedUpdate () {
        if (movement != Vector3.zero) {
            playerAnimator.SetFloat ("Speed", 3f);
        } else {
            playerAnimator.SetFloat ("Speed", 0f);
        }
    }
}

1 Answer

Alan Mattanó

PLUS

Hi Arman,
[I’m learning english, my english is not good]
Double click the error and the Mono or Visual Studio editor will open showing you the position with the cursor in where is the error (close to the error). probably it will select the line where is the error.
If it is

          moveHorizontal = Input.GetAxisRaw ("Horizontal");

since moveVertical and Input.GetAxisRaw do not has a red line under it so probably are correct.
There is also a correct line ending (“”); probably “Horizontal” is not declare in the Input system or was change.

So double check the Input setup by selecting in the unity toolbar, Edit -> project Settings -> Input and in the Inspector you will find Axes. Expand the list. Here you find all the inputs Name and in this case must be Horizontal (is upper case sensitive).

Sometimes this settings can change when you import assets that change them. More in detail the file containing this list is in the folder “ProjectSettings”. There is the file InputManager.asset . If you change this file, it will change all the input settings. When you import an asset that change the files in “ProjectSettings”, unity will let you know.

Hope this answer is close to your question. If is not, look if the ‘Animator’ is attached to the game object.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerControler : MonoBehaviour
{
public float Speed;
private Vector2 direction;
private Rigidbody2D rb;

void Start()
{
rb = GetComponent();
}
void Update()
{
direction.x = Input.GetAxisRaw(“horizontal”);
direction.y = Input.GetAxisRaw(“Vertical”);
}
void FixedUpdate()
{
rb.MovePosition(rb.position + direction * Speed * Time.fixedDeltaTime);
}
}
63f5d2e6e370d207318881.png63f5d32e30121303914313.png63f5d34eb15fd140057436.png


  • Вопрос задан

    22 февр.

  • 40 просмотров

В переводчик что ли фарзу забить не можете? у вас ось horizontal не настроена. Сделайте то что написано в ошибке (там прям инструкция), или используйте ту ось которая есть.

Пригласить эксперта


  • Показать ещё
    Загружается…

19 мая 2023, в 00:55

3000 руб./за проект

18 мая 2023, в 23:42

1800 руб./за проект

18 мая 2023, в 22:57

500 руб./за проект

Минуточку внимания

Подскажите как исправить. Анимация персонажа работает, при включении wandering AI Charac, персонаж начинает двигаться автоматически, ходит боком покругу, вперед и опять по кругу. Но из контроля клавишами, откликается только на пробел (прыжок) но на стрелки не откликается.
Выдаётся ошибка в консоли:

ArgumentException: Input Button Sneak is not setup.
To change the input settings use: Edit -> Project Settings -> Input
PlatformCharacterController.Update () (at Assets/Locomotion System Files/Character Controller Scripts/PlatformCharacterController.cs:39)

Но в открывающейся панели Input, не могу понять, что нужно делать…. тут много закладок но Button Sneak нет…

До этого, были ошибки вроде:

ArgumentException: Input Axis Horizontal2 is not setup.
To change the input settings use: Edit -> Project Settings -> Input
AimLookCharacterController.Update () (at Assets/Locomotion System Files/Character Controller Scripts/AimLookCharacterController.cs:23)

Там была ошибка в нащвании опции Horizonta, котоая была укащана без 2.
Но в перечне опций, нет Button Sneak. По этому не знаю, что нужно делать.

An error “ArgumentException: Input Axis Joystick Look Horizontal is not setup.” occurred when Play button clicked.

Some people have the similar problem as I have.
ArgumentException: Input Axis Joystick Look Horizontal is not setup.
Error: Input Axis Not Set Up

It’s easy to solve. Put “<SteamLibrary>steamappscommonHuman Fall FlatWorkshopPackageProjectSettings” into <UnityProjects><Project directory>.

The following is the detail of this problem.

Problem

I followed the guide to start creating workshop of Human Fall Flat in Unity. When I start “Play” mode, I couldn’t control the Human and he was twisted!!

The following is the detail of the error.

ArgumentException: Input Axis Joystick Look Horizontal is not setup.
 To change the input settings use: Edit -> Project Settings -> Input
HumanControls.get_calc_joyLook ()
HumanControls.ReadInput (System.Single& walkForward, System.Single& walkRight, System.Single& cameraPitch, System.Single& cameraYaw, System.Single& leftExtend, System.Single& rightExtend, System.Boolean& jump, System.Boolean& playDead, System.Boolean& shooting)
Multiplayer.NetPlayer.PreFixedUpdate ()
Multiplayer.NetGame.PreFixedUpdate ()
Multiplayer.NetGamePre.FixedUpdate ()

Cause

“Input Axis <NAME> is not setup.” means that the input axis named “NAME” is not defined in Input Manager. Click “Edit” > “Project Settings” > “Input” and check the list of input axis. There is no axis named “Joystick Look Horizontal”.

The project settings, including the “Input Axis”, are defined in the “ProjectSettings” directory in steamapps. Therefore, you need to place this ProjectSettings directory in your own project directory. In my case, I placed a wrong one.

Solution

Close unity project. And put the “ProjectSettings” into the project directory.

Result

You can control the character with no error.

Добавить комментарий