Author Topic: [BUG] Adding UICamera script blocks mouse events (e.g. OnMouseDown)  (Read 2237 times)

krzysieko

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 1
    • View Profile
I do not know if this is on purpose but, as in topic, UICamera blocks OnMouse* events. Solution is to replace lines 934-949 with line 948 alone (or change #ifdef condition).

If this is a bug, you should add checkbox to UICamera to choose behaviour.
If this is not a bug, I suppose it may be because you thought that UNITY_4_0 covers all 4.x versions (which is not true).

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
This is NOT a bug.

OnMouse events should not be used. Ever. In fact they get completely removed in a future version of Unity.

They are ridiculously slow, slowing down your app for no reason because it has to perform a raycast into the entire scene. If that's not bad enough, what's the point of using them when NGUI already gives you a much more robust event framework to work with?

Instead of OnMouseOver use OnHover(bool isOver). Check UICamera's documentation page.