I am always willing to help, open to suggestions and always do my best to offer a quick and useful service to my customers! 😀
Step 1 - All objects that you want to combine must have the "Mesh Filter" and "Mesh Renderer" components. If any GameObject has only 1 of these components, you will see an error message. If any GameObject does not have these 2 components, it will only be ignored.
Step 1 - Select the GameObjects you want to combine, or select the GameObject root that you want to combine the children GameObjects.
(This component is automatically added to all meshes resulting from the merge)
In the Editor Inspector, you can also always hover over a variable name, to see a detailed description of what the variable does.
Does the Easy Mesh Combiner have to combine childrens meshes, which are disabled?
Defines the working mode of Lightmaps support.
Turn this parameter off if you want to use custom parameters for Lightmap generation.
Maximum allowed angle distortion of Lightmap data.
Maximum allowed area distortion of Lightmap data.
This angle (in degrees) or greater between triangles will cause seam to be created.
How much uv-islands will be padded.
The name that will be given to the prefab generated.
Parameters=>[All Fields Below Requires
Parameters=>[All Fields Below Requires
The name of the property in which the EMC should look for textures, in the materials.
The name of the property on which the EMC should apply the texture to the resulting mesh Material.
The name of the shader property, which is responsible for storing the main texture Colors, in the material of its meshes.
The name of the property that the EMC should look for the Metallic Maps in the materials.
The name of the property that the EMC should apply the Metallic Map to the Material resulting from the merge.
The name of the property that the EMC should look for the Specular Maps in the materials.
The name of the property that the EMC should apply the Specular Map to the Material resulting from the merge.
The name of the property that the EMC should look for the Normal Maps in the materials.
The name of the property that the EMC should apply the Normal Map to the Material resulting from the merge.
The name of the property that the EMC should look for the Normal Maps 2 in the materials.
The name of the property that the EMC should apply the Normal Map 2 to the Material resulting from the merge.
The name of the property that the EMC should look for the Height Maps in the materials.
The name of the property that the EMC should apply the Height Map to the Material resulting from the merge.
The name of the property that the EMC should look for the Occlusion Maps in the materials.
The name of the property that the EMC should apply the Occlusion Map to the Material resulting from the merge.
The name of the property that the EMC should look for the Detail Maps in the materials.
The name of the property that the EMC should apply the Detail Map to the Material resulting from the merge.
The name of the property that the EMC should look for the Detail Mask in the materials.
The name of the property that the EMC should apply the Detail Mask to the Material resulting from the merge.
The name of the property that the EMC should look for the Emission Map in the materials.
The name of the property that the EMC should apply the Emission Map to the Material resulting from the merge.
The name of the property that the EMC should look for the Emission Colors in the materials.
Defines the type of Global Illumination to be used by the Emission, in the Material resulting from the merge.
If this option is enabled, EMC will use an algorithm to prevent the generated Normal Maps Atlas from being colored pink. This can be useful on a variety of platforms.
Parameters=>[All Fields Below Requires
The name of the property in which the EMC should look for colors in Materials of each mesh.
The name of the property to which the EMC should apply the color atlas in Material of mesh result.
First the Easy Mesh Combiner looks for the Meshes that are Selected. Then, the Easy Mesh Combiner groups meshes that use the same material. When you have a mesh that uses more than 1 material, the Easy Mesh Combiner will separate the faces of this mesh according to each material.
Green boxes use material A, blue boxes use material B and brown boxes use material C.
With this merge method, if you have 5 meshes, only 1 mesh, 1 material and 1 atlas will remain after the merge. This method is a bit more complex, so try to understand well how it works before using it.
First, it merges all the meshes together, creating a new mesh that is the junction of all. However, this new mesh does not have any material.
One Mesh Per Material: The "One Mesh Per Material" method can merge your meshes with special effects automatically without any problem, plus you will not have to configure anything other than your own shaders.
Just Material Colors: The "Just Material Colors" method is designed to support only material colors, so it does not support texture merging or special effects.
All In One: "All In One" supports special effects of your materials! You just need to enable support and configure it. After that, just merge! See below how to do the procedure.
Step 1 - First, activate support for the effect you want. When you activate support for an effect, the Easy Mesh Combiner, in addition to creating an atlas for your model's textures, it will also create an atlas with the textures of the effect you want. This atlas will be based on the texture atlas of your model.
Property Name To Insert: It is the variable that will store the atlas texture of normal maps, in the final material. For example, at the end of the merge, the Easy Mesh Combiner will look for the variable
Step 1 - Click the GameObject that contains the merged meshes.
Slow merging for meshes with Lightmaps Support
This is a limit of Unity. If you enabled the Lightmap Support option during merge, and a mesh ends up having more than 50.000/64.000 vertices, processing can become VERY slow. You can try reducing the mesh vertices count, or separating the merge into more parts.
Target Meshes - This is a list, and you can define all the target GameObjects in which you want to combine them.
Debug - Here you can consult variables to debug your merges.
To do this kind of merge you can simply create a new GameObject in your scene. Then place the Runtime Mesh Combiner component on this new GameObject. Once this is done, add the GameObjects of the meshes you want to combine to the
See the screenshot below for a simple example of how to arrange GameObjects to combine these meshes that won't move around the scene.
The GameObject "ParentGameObject" has been added to the
Remembering that with the
To do this kind of merging, first find the mesh's parent GameObject, the GameObject that will move all its child meshes. This parent GameObject, which will move, cannot have
See the screenshot below for a simple example of how to arrange GameObjects to combine these meshes that will move around the scene.
The GameObject
In the Editor Inspector, you can also always hover over a variable name, to see a detailed description of what the variable does.
This parameter is only available when selecting the option to disable the original GameObjects, after merging them. As they will be disabled, consequently their colliders will also be, so if this option is enabled, Easy Mesh Combiner can automatically add a Mesh Collider to the mesh resulting from the merge.
using MTAssets.EasyMeshCombiner;
public RuntimeMeshCombiner someRMeshCombiner;
void Start()
{
//- isTargetMeshesMerged();
// Return true if target meshes is currently combined.
bool isCombined = someRMeshCombiner.isTargetMeshesMerged();
//- CombineMeshes();
// Commands the Runtime Mesh Combiner component to make a merge. (If there is no merge already done)
someRMeshCombiner.CombineMeshes();
//- UndoMerge();
// Commands the Runtime Mesh Combiner component to undo a merge. (If there is merge already done)
someRMeshCombiner.UndoMerge();
}
using MTAssets.EasyMeshCombiner;
public GameObject[] arrayOfGameObjectsToMerge;
public RuntimeMeshCombiner someRMeshCombiner;
void Start()
{
//Fill the list of Target Meshes of Runtime Mesh Combiner
foreach (GameObject obj in arrayOfGameObjectsToMerge)
someRMeshCombiner.targetMeshes.Add(obj);
//Set some preferences of merge
someRMeshCombiner.afterMerge = RuntimeMeshCombiner.AfterMerge.DisableOriginalMeshes;
someRMeshCombiner.combineInChildren = true;
//Finally, start the merge
if (someRMeshCombiner.isTargetMeshesMerged() == false)
someRMeshCombiner.CombineMeshes();
//To undo the merge we use
if (someRMeshCombiner.isTargetMeshesMerged() == true)
someRMeshCombiner.UndoMerge();
}
Step 1 - Activate
Optimize Mesh - In Import Settings of yours models. Make sure your models does not have the
Lightmaps support not enabled - If you haven't enabled the "Lightmaps Support" parameter before merging your meshes, try enabling the option first.
Error "SetPerIndexUVs failed..." - This error can occur in certain merges that have the "Lightmap Support" option enabled, and is sent to the Unity console. However, the merge still continues even though this error has occurred, and the resulting mesh from the merge has no Lightmap data. For more information on this error, read this thread.
Problems with original meshes - If the original meshes that make up the resulting mesh have problems in their Lightmap UV data, the resulting mesh may be affected. This mainly happens when the original meshes have UV Overlapping, or don't have Lightmap UVs. This can be noticed by looking at the Mesh Renderer of the mesh that had the problem generating the scene's Lightmap.
Wrong Lightmaps support mode - This issue can also happen if you selected the wrong Lightmap support mode before merging. Usually the "Generate Data" mode is the most compatible, and the mode can be selected under "Lightmap Mode".
If you need to contact me for any difficulty, feature suggestion, bug fix, question or support, just contact me through my email above!