- Home /
Combining meshes into one via editor
What I am trying to do is very simple, combine these three cubes (http://prntscr.com/22o6q6) into one mesh to create a doorway. I've looked at several places but have not been able to find an answer. I want to combine these in order to easily modulate the geometry and reduce the draw calls. Is there an easy way to combine these meshes within the editor? In this video (http://www.youtube.com/watch?v=0xYdkxeEOzM) there is a doorway made from several cubes that seems to be one mesh. There is probably a very simple answer I am overlooking, but I am still a noob! If anyone could point me in the right direction that would be awesome :D
You don't do modelling in Unity. It's just not what it was designed to do!
Use a proper 3d modelling tool such as Blender for all your modelling needs
This isn't modeling it's compound asset assembly. Prefabs for the win!
@Huacanacha actually it is modelling. As the OP said: "I want to modulate the geometry and reduce the draw calls". Your answer does nothing more than group some objects together. It doesn't combine the geometry, nor does it reduce draw calls (unless you use batching, in which case you're just giving yourself more CPU overhead)
The OP could use the Combine $$anonymous$$esh functions in order to generate one single mesh and reducing the draw calls, however a much better (proper) and more optimised method would be to model a doorway yourself.
Right, I guess I should add that I agree using a 3d modeling package to combine the meshes and importing as a single model is the ideal solution. However the question was specifically about achieving this in the Unity editor. A prefab might not be a perfect fit for the requirements but it gives much of the desired effect for little effort, so it's a perfectly reasonable option to consider.
I didn't know about the Combine $$anonymous$$esh functions, I'll have to look at them.
Answer by Huacanacha · Nov 08, 2013 at 06:27 AM
Create an empty GameObject called 'doorway'. Add the three cubes as children. Position them however you like relative to each other to create your doorway. Drag the 'doorway' GameObject from the Hierarchy to the Project View. Delete the 'doorway' GameObject.
Congratulations, you have just created a prefab made up of your three cubes! You can use this pretty much like any other model asset, and it will behave like a single model rather than three separate components.
Note that if the cubes don't share geometry and materials you'll probably only save draw calls if you have multiple doorways in game.
Thank you! this was the answer I was looking for! However, after reading the comments I noticed that modeling in an external software (blender) would be the best solution, but when I import my model to unity it still renders as three cubes (http://prntscr.com/22q5a0) they're just not editable. I know there is something in blender I am doing wrong so I don't think this is the best place to ask, but how could I combine these three cubes as one object in blender (http://prntscr.com/22q5qv)?
I suggest looking at some blender tutorials for hard surface modelling. Then you should understand how to make a doorway ;)
Answer by ChromaRay · Nov 08, 2013 at 08:19 AM
You could create an empty game object and place all of the geometry onto the empty object as children. It wouldn't be all one mesh technically, as that would require a custom mesh to be modeled in a 3D application and export/imported into Unity, but with this option it would at least allow easy access to all three objects at once.