- Home /
Can not destroy Transform component. after upgrade to unity 4
i upgraded my project from unity 3.5 to Unity 4. everything is almost OK. i can run game in editor no error when playing game, but after stopping game it give me some errors about Can't destroy Transform component. ... all references of these errors are to .CPP files like 'GameObjectUtility.cpp Line: 1011'
i checked all of my scripts to see whether i Dispose a Transform but nothing found. all Destroy GameObject.
so i created a simple scene with just a player and no dynamic object. running game is OK but after stopping game : sometime i give no error, sometimes 2 errors, sometimes 3 errors , ...
besides i just running game and do not touch any key on keyboard or mouse to move or fire, but errors keeps happening.
i do not know another way to check scripts for debug.
any idea?
Answer by SkillDev · Jan 15, 2013 at 05:32 PM
After a few months I fluky found the problem. If you want destroy a game object, make sure that transform.parent is null. if you forget, unity does not inform you at destroy time, but when you stop the game in editor then gives you some errors like i said in question.
It is better for unity to give better information about this type of errors.
Answer by crazii · Sep 30, 2017 at 02:29 AM
For my case, I got this error when stop playing while instantiated frefab instance kept in reference and not released. I keep reference to manually update & destroy them. they are not released until they end their lifetime.
I tried use GameObject.Destory() in my script ' OnDisable()/OnDestroy() function, to clean the left objects, but nothing changes.
Then DestroyImmediate() is tried and it works.
Your answer
![](https://koobas.hobune.stream/wayback/20220613084143im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Character not animate after unity 4 upgrade 3 Answers
Convert 3.x Plugins to Unity 4 0 Answers
Unity Free 3.5.4 Project to Unity Free 4.0.1 1 Answer
Upgrading from 4 to 5 0 Answers
Rotating a football with a spiral... 3 Answers