Support => NGUI 3 Support => Topic started by: singh029 on April 29, 2014, 01:15:11 AM
Title: How do I block click events on a button
Post by: singh029 on April 29, 2014, 01:15:11 AM
The player keeps jumping when i click on the pause button.
Is there a way to display click events on top of a button so only the button event is fired, not the click event?
For screen clicks im using
Input.GetMouseButton(0)
and
Input.mousePosition
Title: Re: How do I block click events on a button
Post by: ArenMook on April 29, 2014, 01:26:06 PM
Input is Unity. It can't be blocked by NGUI.
You need to use NGUI's events. Rely on the NGUI's event system fully, or not at all. All NGUI's events are blocked by UI elements and other objects properly. Consult the documentation page for UICamera.
Title: Re: How do I block click events on a button
Post by: singh029 on April 30, 2014, 11:42:46 AM
So can i do something like..
if(UICamera.GetMouse(0))
{
}
If so, is there a static variable to get mouse position?
Or do i need to use the public attribute
Vector2 pos
And im assuming i would need to create a UICamera variable and throw the camera in there, correct?
And do something like..
Vector2 position = uicam.pos;
Title: Re: How do I block click events on a button
Post by: ArenMook on April 30, 2014, 05:51:57 PM
As I said, use NGUI's events: http://www.tasharen.com/forum/index.php?topic=6711.0
Note the long list of events that NGUI sends out? Use those instead of Input. Inside one of those events UICamera.currentTouch tells you all kinds of information, including the current position of the touch event.