MissingReferenceException: The object of type 'MonsterFish' has been destroyed but you are still trying to access it.
Your script should either check if it is null or you should not destroy the object.
问题产生背景:
丑小鸭走到碰撞体的时候,会被鱼的碰撞体做碰撞检测,然后调用鱼的攻击方法。脚本放在碰撞体的空物体上,引入了鱼。丑小鸭会发射子弹干掉鱼。
所以在子弹把鱼干掉后,碰撞体里面对鱼body的引用就缺失了,报错。所以问题解决方法就是,销毁的不是鱼,而是鱼的父物体,就会连同碰撞体一起销毁。问题解决