Search Unity

  1. If you have experience with import & exporting custom (.unitypackage) packages, please help complete a survey (open until May 15, 2024).
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    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,730
    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