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. Dismiss Notice

Mouse scroll wheel detection not working.

Discussion in 'Scripting' started by samualsock, Feb 1, 2015.

  1. samualsock

    samualsock

    Joined:
    Jul 20, 2013
    Posts:
    15
    Hello! I am having what I imagine is a very basic problem. I am making an RTS styled camera and have a problem with using the mouse wheel to scroll in and out.

    Here is my code
    Code (CSharp):
    1. if (Input.GetAxisRaw ("Mouse ScrollWheel") > 0)
    2.     {
    3.         transform.Translate (Vector3.up * speed * Time.deltaTime);
    4.     }
    5.  
    6.     if (Input.GetAxisRaw ("Mouse ScrollWheel") < 0)
    7.     {
    8.         transform.Translate (Vector3.down * speed * Time.deltaTime);
    9.     }
    and when I run it, it displays the error "Input axis Mouse ScrollWheel is not setup". I have checked the input manager and everything seems to be okay? Although I am new to Unity and may be missing something simple MouseScroll.png
     
  2. Sbizz

    Sbizz

    Joined:
    Oct 2, 2014
    Posts:
    250
    Hmm, it seems there is a little "space" before "Mouse" in the Input Manager ?
     
  3. samualsock

    samualsock

    Joined:
    Jul 20, 2013
    Posts:
    15
    Blimey -_- I've been trying to figure it out for the best part of an hour but it was such a tiny fix. Thank you! I'll have to look more closely next time