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

No sprite collision detection

Discussion in '2D' started by vitalis09, Jan 26, 2015.

  1. vitalis09

    vitalis09

    Joined:
    Jun 13, 2014
    Posts:
    6
    Ok so i got 2 objects with Rigidbody2D, BoxCollider2D, none is set to IsTrigger. Its a bullet and a wall. Now when i add


    Code (CSharp):
    1.     void OnCollisionEnter(Collision collision) {
    2.         Debug.Log ("collision");
    3.         }
    to bullet object nothing happens, no logs.

    Collision actually happens, cause the bullet bounce off the wall. In case it matters bullet is network instantiated prefab.
    I looked all the solutions nothing works, even tried to set wall to IsTrigger than use istrogger code to make some detection, still nothing.
     
  2. TwiiK

    TwiiK

    Joined:
    Oct 23, 2007
    Posts:
    1,729
    deli73123 and vitalis09 like this.
  3. vitalis09

    vitalis09

    Joined:
    Jun 13, 2014
    Posts:
    6
    thanks TwiiK, that was the problem.
     
  4. deli73123

    deli73123

    Joined:
    Apr 16, 2014
    Posts:
    6