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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Objects keep colliding even though same-layer collision is disabled

Discussion in 'Physics' started by buhrmi, Apr 16, 2020.

  1. buhrmi

    buhrmi

    Joined:
    Sep 25, 2018
    Posts:
    1
    Hello,

    I'm instantiating a bunch of balls, that I do not want to collide with each other. In the Layer collision matrix I have unchecked Layer 8, and I am instantiating the balls like this:

    Code (CSharp):
    1. GameObject ball = Instantiate(prefab, slot.transform) as GameObject;
    2. ball.layer = 8;
    However, the balls keep colliding. Any idea what might be wrong?
     
  2. Grimps

    Grimps

    Joined:
    Nov 4, 2016
    Posts:
    15
    My guess is that your prefab has children and those children have different layers which do collide. That or your collision matrix is not set properly. You said 8 is unchecked but I'm sure you meant that 8/8 is unchecked.
     
    Xggggggggg likes this.