Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

OnCollisionStay() doesn't get called.

Discussion in 'Scripting' started by jayplusplus, Aug 4, 2014.

  1. jayplusplus

    jayplusplus

    Joined:
    Nov 13, 2013
    Posts:
    7
    Hi, I am facing a weird problem.
    I have a character that has a sphere collider and my land has a mesh collider.
    The problem I am having now is somehow OnCollisionStay doesn't get called even though my character doesn't move at all after OnCollisionEnter got called.
    Weird thing is if I give focus on my scene window then it starts calling OnCollisionStay correctly.
    What am I doing wrong or misunderstanding?
    p.s) I am using rigidbody to control
     
    Last edited: Aug 4, 2014
  2. Fluzing

    Fluzing

    Joined:
    Apr 5, 2013
    Posts:
    815
    Make sure the collider is still there. Pause the game and locate it. I had a similar issue where the collider flew off once it hit the terrain.
     
  3. jayplusplus

    jayplusplus

    Joined:
    Nov 13, 2013
    Posts:
    7
    I turned off all the bouncing related code and still have a same issue
     
  4. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    Could you show the code?
     
  5. jayplusplus

    jayplusplus

    Joined:
    Nov 13, 2013
    Posts:
    7
    I am sorry it's actually few hundreds lines of code.
    I kinda fix it calling rigidbody.WakeUp() every late update.
    But I am not sure what problems could be caused from it.
     
  6. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    bowserscastle likes this.
  7. jayplusplus

    jayplusplus

    Joined:
    Nov 13, 2013
    Posts:
    7