Меню

Input axis horizontal is not setup ошибка

Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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.

Подскажите как исправить. Анимация персонажа работает, при включении 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. По этому не знаю, что нужно делать.

XRTK — Mixed Reality Toolkit Bug Report

Describe the bug

On Play, this error is logged every frame

Input Axis  is not setup.
 To change the input settings use: Edit -> Settings -> Input
  at (wrapper managed-to-native) UnityEngine.Input.GetAxisRaw(string)
  at XRTK.Providers.Controllers.UnityInput.GenericJoystickController.UpdateButtonData (XRTK.Definitions.Devices.MixedRealityInteractionMapping interactionMapping) [0x00052] in D:MTemplateXRTKTemplate9LibraryPackageCachecom.xrtk.core@0.1.19ProvidersControllersUnityInputGenericJoystickController.cs:92 
  at XRTK.Providers.Controllers.UnityInput.GenericJoystickController.UpdateController () [0x00086] in D:MTemplateXRTKTemplate9LibraryPackageCachecom.xrtk.core@0.1.19ProvidersControllersUnityInputGenericJoystickController.cs:57 
  at XRTK.Providers.Controllers.OpenVR.GenericOpenVRController.UpdateController () [0x0007e] in D:MTemplateXRTKTemplate9LibraryPackageCachecom.xrtk.core@0.1.19ProvidersControllersOpenVRGenericOpenVRController.cs:164 
  at XRTK.Providers.Controllers.UnityInput.UnityJoystickDataProvider.Update () [0x00059] in D:MTemplateXRTKTemplate9LibraryPackageCachecom.xrtk.core@0.1.19ProvidersControllersUnityInputUnityJoystickDataProvider.cs:54 
  at XRTK.Services.MixedRealityToolkit.UpdateAllServices () [0x00095] in D:MTemplateXRTKTemplate9LibraryPackageCachecom.xrtk.core@0.1.19ServicesMixedRealityToolkit.cs:1284 
UnityEngine.Debug:LogError(Object)
XRTK.Services.MixedRealityToolkit:UpdateAllServices() (at Library/PackageCache/com.xrtk.core@0.1.19/Services/MixedRealityToolkit.cs:1288)
XRTK.Services.MixedRealityToolkit:Update() (at Library/PackageCache/com.xrtk.core@0.1.19/Services/MixedRealityToolkit.cs:705)

To Reproduce

Open Unity Hub
New Project with 2019.1.14f1
Choose 3D
Modify the manifest per notes https://github.com/XRTK/XRTK-Core/releases/tag/0.1.19
Includes «com.xrtk.core»: «0.1.19», «com.xrtk.sdk»: «0.1.13», «com.xrtk.wmr»: «0.1.5»,
Add scene to Build
Restart Unity
Click Configure (crash)
Reopen unity and Click Configure
Press Play

Your Setup (please complete the following information)

  • Unity Version [e.g. 2019.1.14f1]
  • XRTK Version
    «com.xrtk.core»: «0.1.19», «com.xrtk.sdk»: «0.1.13», «com.xrtk.wmr»: «0.1.5»,

Target Platform (please complete the following information)

  • OpenVR

Additional context

HP Windows Mixed Reality Headset

0 0 голоса
Рейтинг статьи
Подписаться
Уведомить о
guest

0 комментариев
Старые
Новые Популярные
Межтекстовые Отзывы
Посмотреть все комментарии

А вот еще интересные материалы:

  • Яшка сломя голову остановился исправьте ошибки
  • Ясность цели позволяет целеустремленно добиваться намеченного исправьте ошибки
  • Ясность цели позволяет целеустремленно добиваться намеченного где ошибка
  • Indesit стиральная машина коды ошибок на светодиодах
  • Indesit стиральная машина wisxe 10 ошибка h20