Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Scripting Input Manager settings?

Discussion in 'Scripting' started by Eric5h5, Jul 26, 2006.

  1. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    After spending some time fooling around with trying to write specialized behavior code, I realized that the settings in Input Manager do everything I want. But is it possible to change them from within a game? Specifically I'd be interested in changing Gravity, Sensitivity, and Snap on the fly, depending on the situation, but I can't seem to find anything in the manual about doing that, if it's possible.

    --Eric
     
  2. jeremyace

    jeremyace

    Joined:
    Oct 12, 2005
    Posts:
    1,661
    Looking through the script ref, none of that is exposed to the scripting interface. Might be good to have though.

    As for sensitivity, just multiply the values returned from your device by a sensitivity number.

    Code (csharp):
    1.  
    2. float xSensitivity = 1.7F;
    3.  
    4. myVar = Input.GetAxis("Mouse X") * xSensitivity;
    5.  
    -Jeremy
     
  3. CoherentInk

    CoherentInk

    Joined:
    Jul 16, 2006
    Posts:
    216
    Can someone explain why the Input Manager values are read-only in game? Additionally, are there any plans to allow players to set key sensitivity and ramping themselves? My only guess is that it is designed this way because of different environments, i.e. stand-alone vs. web player.

    I'd much rather keep all of the input code confined to the one Input class and not have to augment the behaviour with my own code, especially since all the paramaters are already in the Input Manager.
     
  4. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Rats, that's what I thought. Off to Wish List I go. :)

    Yeah, but unfortunately that doesn't really work with keyboard input, or at least it has a different effect than altering the sensitivity setting in the input manager. Thanks though!

    --Eric
     
  5. Jonathan Czeck

    Jonathan Czeck

    Joined:
    Mar 17, 2005
    Posts:
    1,713
    While I can't really speak for OTEE, I would assume in general it's because features don't exist until someone implements them. I assume there is some glue code that ties together the scripting into the core engine, and the bridge for Input Manager simply has never been written. It has only been recently requested on the forum, at least. OTEE has been excellent in the past about getting in popular feature requests, so I would recommend making your suggestion heard through the appropriate channel and doing what you can to deal with what is there in the mean time.

    Cheers,
    -Jon