It seems like I have some lingering objects around in my scene, that aren’t visible in the Hierarchy view. How is this possible? Whenever I start this scene… I get these error messages for objects that are NOT in the scene hierarchy:
MissingComponentException: There is no 'Transform' attached to the "house_simple_02_pf_combiner" game object, but a script is trying to access it.
You probably need to add a Transform to the game object "house_simple_02_pf_combiner". Or your script needs to check if the component is attached before using it.
CombineChildren.Start () (at Assets\Standard Assets\Scripts\CombineChildren.cs:21)
They have previously been in the scene hierarchy, a long time ago… but were messed around with by editor scripts.
Restarting Unity doesn’t seem to help.
How is it even possible to have objects get Start() called automatically, that are not in the scene hierarchy?
Well this is really strange. I can find these objects using FindObjectsOfType(typeof(Object)) and matching names… however the hideFlags are all 0 for these objects… so I’m quite surprised I can’t see them in the Hierarchy.
Hrm… I guess I can just clean these objects out with my script… but how do I know there aren’t other objects lying around causing potential problems?
If these objects aren’t visible in the Hierarchy, but at the same time have hideFlags 0… then they aren’t easily identifyable it seems.
It looks like a bug to me, please fill a bug report and add a small project that can reassemble the issue, also please let us know what you where trying to achieve, what version are you working on, system specs, etc
Editor scripts and GameObjects without transforms?
Perchance are you using editor scripts to create prefabs? I’ve seen gameobjects without a transform component, but only if I tried to create (not instantiate) a prefab programmatically.
Chances are you used an editor script to destroy an object but were using the Transform as the handle for the object instead of the gameObject. Thus you destroyed the transform component (Which is required for an object to show up in the 2.5 hierarchy) and not the object itself.
If you co to unity 2.1 and open the project, you should see the objects all sitting at the root. You can Manually delete them there. I ran into this some time ago.
I had this happen to me. The actual invisible objects were found in the scene file. Luckily I had a clean backup copy of the scene file replaced it and they were gone.
Just posting to confirm it can happen. Also I was creating objects and deleting them with scripting which method this happens as described above.