Search Unity

Big problem with OnCollisionExit2D

Discussion in '2D' started by ZeevH, Apr 19, 2017.

  1. ZeevH

    ZeevH

    Joined:
    Mar 17, 2017
    Posts:
    4
    Hello friends,
    I have a problem with collision detection and I do not know what to do !
    I have a simple 2D surface (with BoxCollider2D no rigidBody2D). And I have a mario like character which walks
    on this surface. When a character stands still, all is good, only OnCollisionStay2D shoots. But when character walks, on this continious surface with BoxCollider2D, OnCollisionExit2D and OnCollisionEnter2D alternately are called. This weird nature of behavior completely destroys my collision engine logic. I do not wish to start working with raycast, I want to receive only OnCollisionStay2D as long as I stand, or walk, on the same BoxCollider2D. Without this weird OnCollisionExit2D/OnCollisionEnter2D alternation,
     
  2. LiterallyJeff

    LiterallyJeff

    Joined:
    Jan 21, 2015
    Posts:
    2,807
  3. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,459
    You should not get an exit callback if you're not separating from the surface. Sounds like something else is going on beyond your description.

    Do you have a simple reproduction case you can share or even a bug report? Also, can you state what version you're using please.