Author Topic: Mouse Clicks not Detectable Anymore  (Read 4019 times)

codeprince

  • Guest
Mouse Clicks not Detectable Anymore
« on: July 28, 2013, 05:29:46 AM »
All of a sudden none of the elements in my project are clickable. They were working fine and firing when clicked. Even if you move them to a new project or open a new scene and bring the elements back they are still not clickable. I have reverted back to an older version of the same project back when I was sure it was working but still the same problem. Dragging and scroll-bars are working fine except for mouse clicks, nothing!
Please help.

matt1

  • Newbie
  • *
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 28
    • View Profile
Re: Mouse Clicks not Detectable Anymore
« Reply #1 on: July 28, 2013, 07:07:22 AM »
Try NGUI > Attach a collider.

if you can't see the green box around the object, or sometimes I found if the parent is too far apart, then it won't work.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Mouse Clicks not Detectable Anymore
« Reply #2 on: July 28, 2013, 08:33:17 AM »
Dragging works, but click events are not firing? Did you alter UICamera in any way? Enable debugging on your UICamera to see what's underneath the mouse.

codeprince

  • Guest
Re: Mouse Clicks not Detectable Anymore
« Reply #3 on: July 29, 2013, 03:20:28 AM »
Matt1: There is a collider on each target object and it was firing before without problems. The distance and size of the colliders are correct.
ArenMook: I have enabled debugging on UICamera and it is indicating the mouse is correctly positioned above the targeted objects.

Until now everything is perfect as it was two or three days back. All of a sudden ALL clickable objects in the project are not firing when clicked.

Any suggestions guys?

Sad :(

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Mouse Clicks not Detectable Anymore
« Reply #4 on: July 29, 2013, 09:21:58 AM »
Start a new scene, delete the NGUI folder and re-import it. Most likely scenario is you changed something in NGUI that broke it.

codeprince

  • Guest
Re: Mouse Clicks not Detectable Anymore
« Reply #5 on: August 02, 2013, 10:06:34 AM »
The issue has been solved.
Apparently "OnMouseDown" is no longer supported by the new release of NGUI. The following should work fine:

function OnPress(isPressed){
   if(isPressed)
      Debug.Log('This object has been clicked');
}

Thank you :)

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Mouse Clicks not Detectable Anymore
« Reply #6 on: August 02, 2013, 03:34:46 PM »
OnMouseDown is not an NGUI function to begin with. It's Unity's.