Make an object not collide with most other objects efficiently?

This is a really weird question, and it’s different than you think–

I’ve got a randomly-generating basically snake. I don’t want it to collide with itself at all, so I put in a loop of Physics.IgnoreCollision(), but that doesn’t seem to work and they all collide anyway. Here’s the loop:

for (var i = 0; i < arr.length; i++) {

	for (var j = i + 1; j < arr.length; j++) {
		Physics.IgnoreCollision((arr *as Rigidbody).transform.root.collider, (arr[j] as Rigidbody).transform.root.collider, false);*
  •   }*
    
  • }*
    Yes, all of the array elements are Rigidbodies, I am getting no errors, it’s just that they all still collide! Any help, here?

Why you don’t try Layer Collision ?
its simple to use and you dont need any code

http://docs.unity3d.com/Documentation/Components/LayerBasedCollision.html