As a learning exercise, I tried adding more animations to the female character in the Character Customization sample project (http://unity3d.com/support/resources/example-projects/charactercustomization). I’ve added run, jump and die animations successfully but when I look at the Project View, I noticed some differences between my work and the provided animations (i.e. Female@idle1, Female@walk, etc.).
In the Project View, the provided animations only have the animation asset in them (ex. only “walk” is in “Female@walk”) but mine has, in addition to the animation, the mesh pieces like Hair-1, Hair-2, Shirt-1, etc. along with what I think are game objects (they have an icon next to them which is a cube with a piece of paper in front of it) with the same names. In short, my added animation clips also included the entire contents of what is in the provided “Female.FBX” file. Thus, when I added my 3 animations, I ended up with basically 4 copies of the game objects/meshes; at least as far as the entire Project View is concerned.
What I’d like to know is how do I get rid of these meshes from my custom animation clips. I can’t get rid of them in Max because when I do, the Female character will no longer animate properly using my custom animations no matter what I try. Re-importing the provided FBX animation files Unity references into Max shows that those meshes (Shirt-1, Hair-2, etc.) do exist in the provided sample FBX animation files.
So my question is what did Lucas Meijer, Bas Smit, or whoever did the models do to get rid of the Female.FBX assets from their animation files?
Secondary question of lesser urgency is: even though there are (presently) 4 copies of these meshes game objects in my project, is Unity clever enough to realize they are the same thing and thus optimize them into only 1 copy during runtime and/or distribution/packaging?
Unity will not combine all your meshes or animations into one. There is the MeshCombineUtility in the standard assets which will combine the meshes for you.
For the animations are you using the import settings or “Character@Animation” for creating your animations? If your using the import settings to split the animation. Try the other.
I’m not entirely sure what you mean by the first method but I believe I’m using the “Character@Animation” method. Basically I opened the provided Female@walk.max file, changed the animation to a run cycle and exported it to an FBX file named Female@run.fbx using the steps described in http://unity3d.com/support/documentation/Manual/HOWTO-ImportObjectMax.html#bones. Unfortunately, the meshes are also exported and listed in the Project View. I get the same result if I save the Female@run.max file into the project’s asset folder.
So the question still remains. How do I get rid of the mesh in the Female@run asset in the Project View?
The attached image shows my conundrum. The Female@run asset was the only thing I added to the sample project previously mentioned. It has, in addition to the run animation, all the assets found in Female (highlighted in blue in the screen shot). Compare that with Female@walk which only has the walk animation. How do I make my animation asset like this? The run animation works as is but I’d like to optimize this if possible.
Are you sure about this? When I inspect the Female tree in the Hierarchy view, I only see one instance of each mesh.
I did some playing around on Blender (Sorry, I don’t have Max), and I found that in the FBX exporter you could control what you export. So I turned off the mesh and all’s it exported was the armature and the animation. I hope that helps some.
Here’s the images at the bottom. It’s a different model but the same idea.
Also, I want to correct something I said earlier.
If you have multiple copies of the same mesh in your project folder, Unity will only put one in the final build. I misunderstood your question.
I do prefer Blender myself but the sample demo came with Max files and the run cycle I used was obtained from a .bip file so I used Max for this.
Your Blender sample is encouraging but I’m wondering if the animation will still stick if you don’t export the armature. Anyway, for Blender, I’d prefer to use multiple animation clips and just save the file in the project folder instead of this Object@Animation.fbx convention. Unity does a seamless (if somewhat slow) job of importing/sorting out the animations from the Blender file.
Thanks for taking the time to reply Peter. It’s been informative but I’m still hoping to get a response on the “how” of my original question.