Resources.Load() .fbx file with multiple mesh children.
I have a car model imported into the Unity resources, and it has multiple parts to it (body, tires, etc.), each with it's own mesh. I'm currently using the following code
Mesh mesh = (Mesh)Resources.Load ("car", typeof(Mesh));
but it only loads in the first instance of a mesh, being the body and rollcage. How can I tweak the script so that it
A) Loads all of the meshes individually as children into one empty object (where the script is attached), and
B) Does so in such a way so that I can iterate through these new children afterwards?
Answer by jonesto95 · Feb 24, 2016 at 11:19 PM
Turns out I found the answer. Just change Resources.Load() to Resources.LoadAll(), and make the output type Mesh[].
This is exactly what I needed. I just changed the line so that I could snag a specific mesh from the FBX like so:
$$anonymous$$esh hand$$anonymous$$esh = Resources.LoadAll<$$anonymous$$esh>("Fem")[5];
selecting the 6th part.