Author Topic: [3.5.1] Bug with UICamera and Unity2D event types  (Read 2169 times)

mudflap

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 2
    • View Profile
[3.5.1] Bug with UICamera and Unity2D event types
« on: March 01, 2014, 05:25:35 PM »
Hey guys,

I found a problem with UICamera using Unity2D event types. I just want to make sure I fixed it right...

The bug is that Physics2D.OverlapPoint(pos, mask) is using a Viewport coordinates instead of world coordinates that OverlapPoint requires.

Here's the fix:
         else if (cam.eventType == EventType.Unity2D)
         {
Added this -->      var worldPos = currentCamera.ViewportToWorldPoint(pos);
            Collider2D c2d = Physics2D.OverlapPoint(worldPos, mask);


That fixed it.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: [3.5.1] Bug with UICamera and Unity2D event types
« Reply #1 on: March 01, 2014, 09:02:25 PM »
Yup, thanks, this was already fixed in 3.5.2 that I'll be releasing shortly.