Scripting error

I keep getting this error whenever I cut down one of my trees.

Coroutine couldn’t be started because the the game object ‘CocoTrunk01’ is inactive!
UnityEngine.MonoBehaviour:StartCoroutine_Auto(IEnumerator)

Here are the scripts I am using.
This one is on the trunk that falls and is destroyed after 10 seconds.

#pragma strict

function TreeFall () 
{
	rigidbody.isKinematic = false;
	rigidbody.AddForce (1, -2, 0);
	KillTree();
}

function KillTree ()
{
	yield WaitForSeconds(10);
	Destroy (gameObject);
}

And this one is on the piece that is destroyed when attacked that causes the trunk to fall. This piece also has a simple damage script attached but I don’t think that’s causing any problems.

#pragma strict

var trunkScript : TreeTrunk;

function OnDisable () 
{
	trunkScript.TreeFall();
}

The error isn’t a huge deal I would just like to get rid of it to optimize a little better(plus it’s annoying!). If I’m missing any information to solve this problem let me know. Thanks for any advice.

Like the error suggests, you can’t start a coroutine on a disabled GameObject. Before we get clever and try to disable it before starting the coroutine, it’s also noteworthy that deactivating a GameObject will stop any coroutines attached to it.

If you need to, you can get around this by attaching the coroutine to a separate object.

With that said, if all you’re doing is a ten-second wait before calling Destroy, you don’t even need a coroutine for that. Destroy has a little-known optional parameter which specifies a delay in seconds.

So these are equivalent:

//coroutine
yield WaitForSeconds(10);
Destroy (gameObject);

//not a coroutine
Destroy(gameObject, 10);