Author Topic: [Input Manager] how do you allocate a NGUI button to Unity Input Manager?  (Read 3624 times)

lixobags

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 2
    • View Profile
Hello,

New to Unity here, Im currently trying to adjust a script i purchased and was hoping someone can help me out here.

The current script contains "InputGetAxis" where if you press up or down it moves the car forward and backwards.

***************************************************************************************************************
void FixedUpdate()
{
if (!Enabled)
return;

#region UserInput
float vertical = Input.GetAxis("Vertical"); //Forward & Backward drive input
float horizontal = Input.GetAxis("Horizontal"); //Angular velocity control input
float space = Input.GetAxis("Jump"); //break control input
#endregion

if (vertical > 0)
CurrentEngineAcceleration = Acceleration * vertical;
else CurrentEngineAcceleration = (Acceleration * vertical) * BackwardAccelerationFactor;
*****************************************************************************************************************

What i would like to know is, how do you go about allocating an NGUI button to the work as Input Manager "Vertical" can you do this or no?

Thanks for the help if you can

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
I'm sorry, but this is support forum for NGUI, and I'm not sure how any of the code you posted relates to NGUI. I can help with NGUI's code, and answer questions, but I can't write code to make some third party code work for you.

If you are trying to replace InputGetAxis stuff with NGUI buttons, then just make buttons and inside their OnPress(bool isPressed) functions record whether the button is pressed or not.