Search Unity

OnCollisionEnter2D & OnTriggerEnter2D on 5.3 not working?

Discussion in '2D' started by enhawk, Dec 9, 2015.

  1. enhawk

    enhawk

    Joined:
    Aug 22, 2013
    Posts:
    833
    Seems OnCollisionEnter2D & OnTriggerEnter2D are very slow to register, or don't react at all. Like a threshold has been increased?

    My game relies heavily on these interactions, so 5.3 is not really useable without a fix.

    Anyone else?
     
  2. oliran

    oliran

    Joined:
    Sep 29, 2015
    Posts:
    49
    I'm having the same issue since updating to 5.3 today for OnTriggerEnter2D. Code didn't change, but it stopped calling.
     
  3. aareaux

    aareaux

    Joined:
    Dec 9, 2015
    Posts:
    1
    My collisions are working for the most part, but when I collide with one of my "Warp" colliders (I use it to teleport the character to another portion of the zone) it teleports me to the target I have set up but after maybe half a second it moves my character in a random direction. I had the same issue back in 5.2 which made me go back to 5.1 -_-
     
    Last edited: Dec 9, 2015
  4. enhawk

    enhawk

    Joined:
    Aug 22, 2013
    Posts:
    833
    Is this the 0,0 bug? I think that was fixed.
     
  5. oliran

    oliran

    Joined:
    Sep 29, 2015
    Posts:
    49
    I found a fix... I think this was being caused by my parallax script moving the colliders manually using transform.position. They stopped registering when I did that. However I was able to fix by adding a rigidbody to the collider and setting it to Kinematic.
     
  6. tedthebug

    tedthebug

    Joined:
    May 6, 2015
    Posts:
    2,570
    Mine stopped working as well. I've tried rigid bodies on everything & break points to step into the code but nothing is registering (collisions or triggers)
     
  7. PeterShoferistov

    PeterShoferistov

    Joined:
    Sep 22, 2013
    Posts:
    59
    Same problem. I have a few standard enemy prefabs with some sort of EnemyBehavior script attached to them. Technically they all are almost identical but few of them just don't call OnCollisionEnter2D methods. Sometimes when I manually changing the layers or tags (lets say from enemy to default and then back to enemy), everything works. But it also happens from time to time, not always.
     
    Last edited: Dec 9, 2015
  8. enhawk

    enhawk

    Joined:
    Aug 22, 2013
    Posts:
    833
    I think we can safely say it's not working properly, seem to be a few threads about it.
     
  9. tedthebug

    tedthebug

    Joined:
    May 6, 2015
    Posts:
    2,570
    The op on another thread just raised a bug report
     
  10. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,497
    All these posts but not a single bug report is disconcerting.

    The only known issue is that there can be a single physics-update delay when re-positioning bodies via the Transform rather than using Rigidbody2D.MovePosition (as is recommended). This has been fixed and is on its way to the patch release stream for 5.2 & 5.3.

    Can you please provide me with bug case numbers please?
     
  11. pracalic

    pracalic

    Joined:
    Oct 23, 2012
    Posts:
    14
    The same problem here, but i think i fix it. I replace my collider2d from prefab chaild gameobject to main gameobject and now ontriggerenter2d work fine.
     
  12. enhawk

    enhawk

    Joined:
    Aug 22, 2013
    Posts:
    833
    BTW the bug reporter doesn't send out emails with the bug number any more, sorry.
     
    Last edited: Dec 10, 2015
  13. tedthebug

    tedthebug

    Joined:
    May 6, 2015
    Posts:
    2,570
    I had no rigid body2d on my moving objects (sprites with a circle collider) so just used transform.position for them. I had a kinematic rigid body on the ground object that had a collider on it.
    Edit: & the collisions, & triggers when I tried them, didn't fire at all.
     
    Last edited: Dec 10, 2015
  14. tedthebug

    tedthebug

    Joined:
    May 6, 2015
    Posts:
    2,570
    I didn't realise the rest of the sentence didn't actually appear on screen (a common problem since I need to look at the keyboard to type). I edited my post to say that using rigidbody2d didn't make any difference for me.
     
  15. grosssmutttr

    grosssmutttr

    Joined:
    Apr 15, 2014
    Posts:
    168
    Submitted a report: (Case 774128)