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

my character dont detect collision despite colliding

Discussion in 'Editor & General Support' started by ksnkfs, Dec 5, 2014.

  1. ksnkfs

    ksnkfs

    Joined:
    Nov 30, 2014
    Posts:
    35
    Hello, I have a problem I dont really understand myself. I have a character that move in a basic manner and can collide(In a very bizzare way but still collide) with wall. That Being said, I need that my console detecte this collision and even if the wall bloc him, their seem to have no collision detection.I put that in my player script
    void onCollisionEnter(Collision col)

    {
    if(col.gameObject.name=="wall")
    {

    print("zut");
    }
    }
    and there is no print do.
    the game objet is write correctly, in fact , I have a laser actor who have a pretty similar line in his script and there is no detection problem with the laser, when he hit the wall, there is a print, but when my player collide, no print at all, any idea what is happening%?
     
  2. fffMalzbier

    fffMalzbier

    Joined:
    Jun 14, 2011
    Posts:
    3,276
    onCollisionEnter will never be called by the physics engine , it has to be OnCollisionEnter.

    If you still not get your print inside the if statement you should debug what the "col.gameObject.name" give you via Debug.Log()
     
  3. ksnkfs

    ksnkfs

    Joined:
    Nov 30, 2014
    Posts:
    35
    Damn I should have see that one , anyway it work thanks