Get collision of a GameObject

I’m looking for some documentation on collision, but can only find it within a class. I’d prefer not to do that as it is just a CreatePrimitive(); Provided example code from Unity Documentation below.

using UnityEngine;
using System.Collections;

public class DestroyCubes : MonoBehaviour
    void OnCollisionEnter (Collision col)
        if( == "prop_powerCube")

Anything on how to get collisions of a specific GameObject. In my case,



To detect collision you need following thing attach to gameObject where you want to detect collision.

  1. rigidbody component attach to it.

  2. collider component attach to it.

  3. Script which detects collision. Script have method OnCollisionEnter (to detect collision) and if your collider component have IsTrigger Set than use OnTriggerEnter .

OnCollisionEnter function called when your gameObject Collide to other gameObject.
Other GameObject must have Collider attached to it.

And This function only use for 3D colliders if you use 2DCollider use OnCollisionEnter2D and OnTriggerEnter2D and Rigidbody2D.

I suggest to go through official tutorials.