Brickwall problem

I’m working on a project, and have a problem. I have 4 different types of bricks and need to build a brickwall with these 4 types. Is there a simple scriptcode to solve this?

Yes it is easy. You can use “function OnTriggerEnter” in the ball or in the object that you use for break the bricks.

You need to check the Is Trigger option in the checkbox of the brick’s rigidbody.

Later, in the function you need to check the name of the object that collided and do different things with the 4 bricks.

function OnTriggerEnter (brick : Collider)
{
swich (brick.name)
{
case (brick1):
//Lines for the brick one…
case (brick2):
//Lines for the brick one…
.
.
}
}

Im sure that there are a lot of easyer ways for this, but now i have thought this.