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.
public class DestroyCubes : MonoBehaviour
void OnCollisionEnter (Collision col)
if(col.gameObject.name == "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.
rigidbody component attach to it.
collider component attach to it.
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.