Archive for category Blender/Unity Integration
While working on an collaborative AI project, I came across a very interesting issue with some Blender models.
Since AI was the focus, we decided not to worry much about the graphics, and imported some models off of a Blender community site. We found a house that didn’t have too many polygons which looked pretty good. Upon importing this asset and placing a few instances around the scene, we found that the graphics performance decreased dramatically.
At first, we thought it was just because the house had too many pieces, so we used the Combine Children script to try to bring them all into one mesh. This helped a little, but the draw calls were still way too high.
After further investigation, we discovered that there was some funky bit of disconnected triangles floating around each house. Each of these triangles had something like 30 individual materials attached to it. That was the root of our problem. The only question was, where did this come from?
It turned out that the .blend file had some extra objects in it that the artist had used to store materials that he/she may have wanted to reuse later. Well, this object didn’t show up in the 3D window, so it wasn’t apparent to the casual Blender user that it even existed. However, Unity imported it as if it were any other object, which caused the problem.
What’s the solution? Well, if you don’t care about maintaining connections with your mesh objects, just delete the offending mesh object from the scene hierarchy or prefab and all is well. If you do care, there’s an easy workaround.
Open the file in Blender, and open the “Outliner” window. In here, there are two nice views. One is an object-oriented look at all your objects and their connections, this is called the “Oops Schematic“. The other, shows a list of everything in the scene, simply called the “Outliner“. The latter is the one you want.
If you are not in the Outliner, click on the View menu and choose “Show Outliner”. Now you should see every object in the file, even those that aren’t visible in the 3D window. All you have to do is click on the offending object and delete it. If your artist sends you a new copy of the file, just repeat the process.