Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: Johnnemann on November 05, 2012, 12:55:08 AM

Title: UISlider, game controllers, and OnPress
Post by: Johnnemann on November 05, 2012, 12:55:08 AM
Hi!

I had a problem with UISliders when used with a gamepad. Pressing the Confirm button would make the slider value 0 - this is because "OnPress" on the slider tries to figure out where the mouse pointer is on the slider to set the thumb correctly, and with a gamepad there's no mouse pointer, so it ends up defaulting to 0.

I fixed this in the following way in the UISlider code, Line 143:

void OnPress (bool pressed) { if (pressed && (UICamera.mainCamera.GetComponent<UICamera>()).useMouse) UpdateDrag(); }

This works for me, as gamepad and mouse are mutually exclusive.

Anyway, I am posting this here so that this can be fixed in the next version of NGUI, and so that the answer is out there if anyone needs it.

Thanks!

Johnnemann
Title: Re: UISlider, game controllers, and OnPress
Post by: ArenMook on November 05, 2012, 04:44:27 AM
I will look into it, thanks.