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.