Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  3. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Click, Drag and etc. handlers with Collider2d are not working in unity 5.5.0x3-2D

Discussion in '2D Experimental Preview' started by castor76, Jan 1, 2017.

  1. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    The same bug list in here :

    https://forum.unity3d.com/threads/c...er2d-are-not-working-in-unity-5-5-0b2.429879/

    is also the case for the 2d experimental build.

    Event systems such as OnPointerClick etc, does not work with Collider2D.

    I am not sure if this has been fixed in the non experimental build, but since this is for the 2D , experimental build with this kind of bug is extremely difficult to work with. If this bug has been fixed , but not for experimental build, can we at least get this fix in and re-release version 3 please? :(
     
  2. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,585
    This was a bug in the UI system (not 2D physics) and I believe it was some reflection-cache issue that affected the Physics2DRaycaster. I know the UI team fixed it in our trunk (5.6) and I can only presume it was backported to 5.5. I can try to locate the fix to see if/when it was backported to 5.5.
     
  3. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,585
    I have checked and this issue fix is already in Experimental Preview #3 so I am not sure what you are seeing.
     
  4. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    Humm.. strange. If I use Boxcollider instead of Boxcollider2D it all works fine. BoxCollider2D doesn't register any events from standard input. Not talking about OnMouse..

    Just double checked it again, and yeap.. Collider2D doesn't register any events. Just by swapping with 3d counter parts and all works fine.
     
  5. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    Garhhh! I just found out that I didn't switch the raycaster to 2d counter part! Dho!

    Extremely sorry about my short sight. :!

    I think it is working now.
     
  6. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,585
    Just so you know, the 2D physics system doesn't 'register events' nor is it directly involved in them at all. The UI 2D raycaster uses GetRayIntersectionAll but the bug was in the UI code, specifically a reflection cache that cached the methods used by the caster etc. In this case, it incorrectly cached the above method (it actually assigned NULL) so the 2D raycaster stopped working. The fix was in the UI code to correctly cache the above method.

    The 3D equivalent method was cached correctly so it wasn't affected.

    Glad you got it working. :)