Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

trubble with: ArgumentException: Input Axis Horizantal is not setup.

Discussion in 'Scripting' started by EVenus1, Apr 1, 2015.

  1. EVenus1

    EVenus1

    Joined:
    Mar 31, 2015
    Posts:
    16
    hi i am truing out some bits and every time i run my game i get this

    ArgumentException: Input Axis Horizantal is not setup.
    To change the input settings use: Edit -> Project Settings -> Input
    PlayerControler.FixedUpdate () (at Assets/scripts/PlayerControler.cs:8)

    bellow is the script i used for the controls:-

    using UnityEngine;
    using System.Collections;

    public class PlayerControler : MonoBehaviour
    {
    void FixedUpdate()
    {
    float moveHorizantal = Input.GetAxis ("Horizantal");
    float moveVertical = Input.GetAxis ("vertical");

    Vector3 Movement = new Vector3 (moveHorizantal, moveVertical, 0.0f);

    GetComponent<Rigidbody>().AddForce (Movement);
    }

    }

    plz help
    Thank you very nuch
    Evenus1
     
  2. passerbycmc

    passerbycmc

    Joined:
    Feb 12, 2015
    Posts:
    1,739
    You misspelled "Horizontal"
     
  3. EVenus1

    EVenus1

    Joined:
    Mar 31, 2015
    Posts:
    16
    where
     
  4. passerbycmc

    passerbycmc

    Joined:
    Feb 12, 2015
    Posts:
    1,739
    In every instance of it, you keep putting a A where the 2nd O should be.

    Also please use CODE Tags
     
  5. EVenus1

    EVenus1

    Joined:
    Mar 31, 2015
    Posts:
    16
    hi very sorry didnt see that and now it tells me there is a problem with my vertical axis
     
  6. passerbycmc

    passerbycmc

    Joined:
    Feb 12, 2015
    Posts:
    1,739
    Vertical needs a capital V.
    I'm assuming your rushing or English is not your native language. Either way just take your time expecially working with strings.
     
  7. EVenus1

    EVenus1

    Joined:
    Mar 31, 2015
    Posts:
    16
    this is now my code and it keeps having problems:-

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class PlayerControler : MonoBehaviour
    5. {
    6.     void FixedUpdate()
    7.     {
    8.         float moveHorizontal = Input.GetAxis ("Horizontal");
    9.         float moveVertical = Input.GetAxis ("Vertical");
    10.  
    11.         Vector3 Movement = new Vector3 (moveHorizontal, moveVertical, 0.0f);
    12.  
    13.         GetComponent<Rigidbody>().AddForce (Movement);
    14.     }
    15.  
    16. }
    17.  
    i now dont know whats wrong
    also if u see any other errors can you point them out
     
  8. passerbycmc

    passerbycmc

    Joined:
    Feb 12, 2015
    Posts:
    1,739
    Well that code should not error, but your movmeant will be unpredictable since your are adding force every physics frame so speed will add up fast.
     
  9. EVenus1

    EVenus1

    Joined:
    Mar 31, 2015
    Posts:
    16
    i get this error:-

    ArgumentException: Input Axis vertical is not setup.
    To change the input settings use: Edit -> Project Settings -> Input
    PlayerControler.FixedUpdate () (at Assets/scripts/PlayerControler.cs:9)
     
  10. passerbycmc

    passerbycmc

    Joined:
    Feb 12, 2015
    Posts:
    1,739
    Hmm according to the error you forgot the capital V, go look in your input settings and make sure the axis is named correctly there.

    Edit: forget to save the changes maybe?
     
  11. TRG96

    TRG96

    Joined:
    Mar 26, 2011
    Posts:
    102
  12. EVenus1

    EVenus1

    Joined:
    Mar 31, 2015
    Posts:
    16
    i have a V in my vertical input so i dont get what is wrong
     
  13. Pigny

    Pigny

    Joined:
    Nov 7, 2015
    Posts:
    1
    It's been a while, so not sure if you have figured it out yet but...

    I think the error is here

    Vector3 Movement =newVector3(moveHorizontal, moveVertical, 0.0f);

    It should be:
    Vector3 movement = new Vector3(moveHorizontal, 0.0f, moveVertical);

    Hope this helps1
     
  14. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    No, that's not it at all. The Z axis isn't vertical, and in any case it's not an error either way. The error is 'Input Axis vertical is not setup', which means there is nothing called "vertical" set up in the input settings. What you have in the code and what you have in the input settings must match, simple as that. And yes it's been a while. ;) Generally it's not worth digging up old topics like this since the OP has likely long since moved on.

    --Eric
     
  15. xaocitn

    xaocitn

    Joined:
    Jul 29, 2022
    Posts:
    1
    Debatable. Errors are constant, and 7 years after the first question of the author, I have the same problem
     
  16. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    You spelled it "Horizantal"?