Hello,
I am a beginner to Unity - so must ask this question (using Blender for the models).
When developing the 3D models that I aim to put in my game, should they be single mesh or comprised of multiple objects?
For example, developing a model of a castle, should that be made of one entire object (mesh), or be comprised of multiple objects (such as an object for each wall, an object for each tower etc.)?
Is there any reason why using a single mesh would be more advantageous than multiple objects in one model, or vice versa?
Thanks,
roza330
Iâd say sometimes itâs impossible to do everything into a single mesh. It gets hard to put textures later if you have big meshes.
I usually create all my meshes and export individually to Unity, then in Unity I group everything underneath a game object.
One example: I had a racing car draw in 3DS Max⌠for the front wing, rear wing, tires., I had all in separated meshesâŚ
It was useful when I needed to show a âbrokenâ front wing, and I needed to do was to deactivate my normal front wing mesh and activate the broken front wing mesh.
On your castle, you might want the doors to open⌠itâs kinda hard to do a door opening animation if you donât have the doors in a separated mesh⌠IMHO.
My understanding is that for slight speed purposes you are better with a single object. It isnât a big deal depending on how often you do it(how many objects, etcâŚ) but those child objects do end up in a tree of subobjects, etc⌠so it may have a slight effect on speed in theory as Unity traverses the tree of gameobjects. I havenât tested, and most likely in most situations this wonât effect much if at all.
Now, for batching purposes, you want to try to make things use the same material when you can. Unity can do static and dynamic batching on things that use the same material, which does have to be the same texture set as well. So if you have a castle and things all with the same texture, it could likely get drawn in a single draw call, regardless of whether it is in multiple objects or not.
The one advantage to having things in multiple objects, is actually a requirement if you need it, that you can separately animate the pieces via Unityâs animation system. If you have everything as a single object, Unity canât animate it except as a whole. The animation system can if you have skeletal or even vertex animation, but that is a separate thing of course.
1 Like
The bottom of the page has some useful information. It looks like Unity 4x info so I donât know if this has changed with updates.
Thanks for the quick replies, guys! Youâve been a great help.
For anyone else in the same situation, what Iâve gathered from these helpful people are:
- Separate objects/meshes are advantageous for parts of a total object that need animating.
- Having as few different meshes as possible, sharing materials, can benefit overall performance.
- Less objects means that Unity does not have to waste time processing longer lists of objects to find what you are looking for.
In my castle example, I would do the following: create a single mesh for the main body of the castle, but have its doors in a separate object so that I can easily animate them to open or close.
1 Like
Yes, but depends on how large your castle is. Since Castles are usually pretty large, especially in comparison to doors then it is likely youâll want to split up the castle into chunks so that large areas which are currently not within the viewport can be culled.
You see in truth there is no right answer to your original question, just a number of good generalizations that should be considered as you design/build your assets/levels. Its then the balancing of these generalized rules to obtain either best performance or visually quality that decides what âweightâ each rule carries in your design/layout choices.
Ultimately in many cases the only way to know for sure is to profile. So in general building models from smaller distinct parts and then combining them either in Unity (static/dynamic batching) or in your modelling application gives you the most freedom to evaluate and experiential. While ensuring as few different materials is nearly always a win in terms of performance, though maybe to the determent of visual interest.
1 Like