When Child gameobject is destroyed , i add a component to his parent. the code like this:
void OnDestroy()
{
Debug.Log("Destroy");
this.myTransformparent.gameObject.AddComponent<GameOver>();
}
then i attach the script to the child.
-
play the game.[29552-qq截图20140722170304.png|29552]
-
nothing to do except to exit the game.
[29553-qq截图20140722170521.png|29553] -
there are some error in the follow.
!IsDestroying() UnityEngine.GameObject:AddComponent() PlayerScript:OnDestroy() (at Assets/Scripts/PlayerScript.cs:121) batchDelete.reservedObjectCount >= batchDelete.objectCount.
any one can help me ?