Gameobject collision with Terrain C#

Hi there,

I’m currently working on a little game wich requires me to have collision between a gameobject and the terrain the game plays on.

This is the script I came up with:

void OnTriggerEnter(Collision other)

	if( == "Terrain")


For some reason this does nothing so I tried letting it collide with other object, those don’t do anything either.

Any help would be greatly apreciated!

Does the gameobject have a rigidbody? Unity docs say that collision events are only called when one of the colliders has a rigidbody attached.

Check your terrain gameObject name in your Hierarchy. Is it “Terrain” or “terrain” ?
Check the spelling so it can much with the name “Terrain” in your script

Does the terrain collider have Is Trigger checked? If not (and I suspect it doesn’t), you should be using OnCollisionEnter(), not OnTriggerEnter().

void OnTriggerEnter(Collision other) {

is wrong … it’s supposed to be

void OnTriggerEnter(Collider other) {