Support => NGUI 3 Support => Topic started by: Anomalous Underdog on September 08, 2014, 05:07:12 PM
Title: How do you stop buttons from responding to right-click/middle-click?
Post by: Anomalous Underdog on September 08, 2014, 05:07:12 PM
I'm making a desktop game and all buttons seem to activate as well with middle-click and right-click.
I want to disable that, for all buttons (and all interactable widgets for that matter) in NGUI. I want it to respond only to left-click.
What's the best-practice way to do this?
Title: Re: How do you stop buttons from responding to right-click/middle-click?
Post by: Anomalous Underdog on September 08, 2014, 05:40:11 PM
Ok, I've been taking a look at the UICamera script. Seems like it's hardcoded to use all three mouse buttons (it loops through Input.GetMouseButtonDown(i) from 0 to 2), and they're all considered the same as far as NGUI is concerned.
I'll just end up editing the code here. If anyone knows of any less intrusive way to selectively choose if NGUI as a whole responds to left/middle/right click, let me know.
Title: Re: How do you stop buttons from responding to right-click/middle-click?
Post by: ArenMook on September 08, 2014, 10:49:13 PM
They are not the same. If you want a button to only respond to right-click, check for UICamera.currentTouchID.
Title: Re: How do you stop buttons from responding to right-click/middle-click?
Post by: Anomalous Underdog on September 09, 2014, 02:49:02 AM
Ok, thanks for that. I wanted a way to do it without having to check for the touch ID on each and every of the buttons/scrollbars I make. I added 3 booleans to UICamera on whether to process or ignore left/right/middle click inputs.