When I import an object from Blender, I’m having an issue due to the way it arrives nested in a second game object.
Now, to be fair, I’ve used only Blender (and not other 3D editor) as my external tool for object creation with Unity, so I have no experience with other 3D .apps in this situation, and can only compare it with objects created in Unity.
To be clear, these are objects that as created in Blender, UV Textured in Blender using textures already resident in the asset tree, and the finished object is then saved in the asset tree for automatic import into Unity.
If I compare two textured spheres, one created with Blender, and the other with Unity, the Blender object comes nested within another game object.
In the root object (above), all I find are the animations (in this case, none, but I’ve not changed the settings to “no animation” for the purpose of this example) and the nested sphere object.
In the case of the nested sphere object (below), I find the rest of the meshes, renderers, etc., can be found.
If you compare this to the Unity sphere (below), all the necessary information is in one object (tho’ admittedly, no animations).
The problem this causes, is when trying to use these Blender objects in a game, if I don’t put something into the root game object, I can get errors like “the game object you are trying to instantiate is a null”, and if I try to attach scripts to the root object, it can complain that the script is looking for a collider but can’t find one. If I put the scripts on the sphere, it can generate other errors or odd behaviour, where, in the case of a “destroy” after time script, it destroys the mesh object, but not the now empty game object. If I apply rigid bodies and/or colliders to both layers to try and avoid the fact that the scripts are looking for tags and colliders on one layer or the other, things get even more wonky. I also find that tags are unpredictable (at least by me) because it’s unclear what layer I should be tagging, and tagging often needs the rigid body and the collider for scripts to see it.
Now, I can lose connection to the .blend file and rip out the sphere, which in this case “shouldn’t” be a problem, as I don’t need the non-existent animations, but what happens if I create a blender object “with” animations that I need? And I’d rather not lose connection with the original Blender object for the speed of the workflow and editing.
To stop the whining, I guess I’m asking:
Is this an expected behavior for Blender objects saved in the Unity Asset tree?
Is there a good/better/best workflow for Unity that I’m missing ior misunderstanding?
How do I work with nested game objects when I’m trying to create PreFabs that are being instantiated and scripted? And need physics like rigid bodies and colliders that work with tags?
What do I do when I need to keep objects with animations attached?