Painted trees do not take their prefab's collider

The trees I painted on my landscape do not have colliders, despite the fact that Unity is painting a prefab which has a collider. In fact, if I place that same prefab on the landscape directly, the tree does have a collider. It's only when I paint the trees does this problem occur. Is it something about painting that makes everything collider-less?

I'm not sure how to do this either, but you could, in the terrain collider script, check generate tree colliders. Or, you could download the terrain assets on the unity website and use the sicomore with collider prefab for a tree. Hope it helps!!! :)

I’ve done both. Capsule collider COMPONENT in a tree and for other trees I have added two or more GameObjects Capsule with collider to the tree prefab.

only the collider component generate a proper collision.

Maybe if all the capsules inside the trees have a rigidboy attached, the collision with a standard unity’s FPS character would work properly?

I’ll go and test that.

Ancient as this is I had the same issue, I resolved it by tagging the terrain.
Sorry for the necromancy but if it can help someone else out then it’s worth it.


TL|DR

It’s not the trees!

Try using a tag on the terrain and then have the collision detection look for that tag, like so;

void OnCollisionEnter (Collision other){
	// If the entering collider is a tree...
	if(other.gameObject.tag == "Tree"){
		Debug.Log ("Ow");
	}
}

Initially I’d tried all I’d found online to try and fix it, I even tried tagging the trees with a Tree tag,
re-prefabbing them, and then trying to repaint the re-prefabbed tree but nothing worked.

Last night I accidentally gave my terrain the Tree tag and boom, it worked, all sorted.

My collision code is:

void OnCollisionEnter (Collision other){

	// If the entering collider is the enemy...
	if (other.gameObject.tag == "Enemy") {
		hit = true;
	}

	// If the entering collider is a tree...
	if(other.gameObject.tag == "Tree"){
		Debug.Log ("Ow");
	}
}

My thinking is that the tree colliders, which are part of the terrain, are actually seen as the terrain. This might not be a workable workaround if you plan on having a character walk on the ground and receive damage if they hit a tree but might be useful for someone.

Hope it helps.