Author Topic: how to detect right click on ngui object  (Read 3835 times)

richardwood

  • Newbie
  • *
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 8
    • View Profile
how to detect right click on ngui object
« on: September 04, 2014, 05:52:18 AM »
hey, how do you detect if user performs right click on my scrollview items? at the moment I'm using this

  1.     public void OnClick()
  2.     {
  3.         if (Input.GetMouseButton(1))
  4.         {
  5.             Debug.Log("Right click on" + thisDisplayname);
  6.         }
  7.         Debug.Log(thisDisplayname);
  8.     }
  9.  

When I left click on my item it works fine, but it doesnt detect my right click, I also browsed somewhere and tried OnRightClick, but it doesnt trigger my debug log

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: how to detect right click on ngui object
« Reply #1 on: September 04, 2014, 10:57:16 AM »
Get rid of the Input.GetMouseButton line and replace it with "if (UICamera.currentTouchID == -1)".

petrucio

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 13
    • View Profile
Re: how to detect right click on ngui object
« Reply #2 on: October 23, 2014, 03:35:57 PM »
== -2