Exemplo n.º 1
0
    void removeSelectedObjects()
    {
        MB3_MeshBakerRoot mom = (MB3_MeshBakerRoot)target;

        if (mom == null)
        {
            Debug.LogError("Must select a target MeshBaker to add objects to");
            return;
        }
        List <GameObject>    objsToCombine = mom.GetObjectsToCombine();
        HashSet <GameObject> objectsAlreadyIncludedInBakers = new HashSet <GameObject>();
        GameObject           dontAddMe = null;
        Renderer             r         = MB_Utility.GetRenderer(mom.gameObject);

        if (r != null)
        { //make sure that this MeshBaker object is not in list
            dontAddMe = r.gameObject;
        }
        List <GameObject> objsToRemove = FilterList(objsToCombine, objectsAlreadyIncludedInBakers, dontAddMe);

        for (int i = 0; i < objsToRemove.Count; i++)
        {
            objsToCombine.Remove(objsToRemove[i]);
        }
        SerializedObject so = new SerializedObject(mom);

        so.SetIsDifferentCacheDirty();
        Debug.Log("Removed " + objsToRemove.Count + " objects from " + mom.name);
        helpBoxString += String.Format("\nRemoved {0} objects from {1}", objsToRemove.Count, mom.name);
    }
        void addSelectedObjects()
        {
            MB3_MeshBakerRoot mom = (MB3_MeshBakerRoot)target;

            if (mom == null)
            {
                Debug.LogError("Must select a target MeshBaker to add objects to");
                return;
            }

            List <GameObject> newMomObjs = GetFilteredList(addingObjects: true);

            MBVersionEditor.RegisterUndo(mom, "Add Objects");
            List <GameObject> momObjs = mom.GetObjectsToCombine();
            int numAdded         = 0;
            int numAlreadyInList = 0;

            for (int i = 0; i < newMomObjs.Count; i++)
            {
                if (!momObjs.Contains(newMomObjs[i]))
                {
                    momObjs.Add(newMomObjs[i]);
                    numAdded++;
                }
                else
                {
                    numAlreadyInList++;
                }
            }

            SerializedObject so = new SerializedObject(mom);

            so.SetIsDifferentCacheDirty();
            if (numAlreadyInList > 0)
            {
                Debug.Log(String.Format("Skipped adding {0} objects to Target because these objects had already been added to this Target. ", numAlreadyInList));
            }

            if (numAdded == 0)
            {
                Debug.LogWarning("Added 0 objects. Make sure some or all objects are selected in the hierarchy view. Also check ths 'Only Static Objects', 'Using Material' and 'Using Shader' settings");
            }
            else
            {
                Debug.Log(string.Format("Added {0} objects to {1}. ", numAdded, mom.name));
            }

            helpBoxString += String.Format("\nAdded {0} objects to {1}", numAdded, mom.name);
        }
Exemplo n.º 3
0
    static bool validateSubmeshOverlap(MB3_MeshBakerRoot mom)
    {
        List <GameObject> objsToMesh = mom.GetObjectsToCombine();

        for (int i = 0; i < objsToMesh.Count; i++)
        {
            Mesh m = MB_Utility.GetMesh(objsToMesh[i]);
            if (MB_Utility.doSubmeshesShareVertsOrTris(m) != 0)
            {
                Debug.LogWarning("Object " + objsToMesh[i] + " in the list of objects to combine has overlapping submeshes (submeshes share vertices). If the UVs associated with the shared vertices are important then this bake may not work. If you are using multiple materials then this object can only be combined with objects that use the exact same set of textures (each atlas contains one texture). There may be other undesirable side affects as well. Mesh Master, available in the asset store can fix overlapping submeshes.");
                return(true);
            }
        }
        return(true);
    }
Exemplo n.º 4
0
        public static void AddDroppedObjects(object[] objs, MB3_MeshBakerRoot momm)
        {
            if (objs != null)
            {
                HashSet <Renderer> renderersToAdd = new HashSet <Renderer>();
                for (int i = 0; i < objs.Length; i++)
                {
                    object obj = objs[i];
                    if (obj is GameObject)
                    {
                        Renderer[] rs = ((GameObject)obj).GetComponentsInChildren <Renderer>();
                        for (int j = 0; j < rs.Length; j++)
                        {
                            if (rs[j] is MeshRenderer || rs[j] is SkinnedMeshRenderer)
                            {
                                renderersToAdd.Add(rs[j]);
                            }
                        }
                    }
                }

                int numAdded = 0;
                List <GameObject> objsToCombine = momm.GetObjectsToCombine();
                bool failedToAddAssets          = false;
                foreach (Renderer r in renderersToAdd)
                {
                    if (!objsToCombine.Contains(r.gameObject))
                    {
                        MB_PrefabType prefabType = MBVersionEditor.GetPrefabType(r.gameObject);
                        if (prefabType == MB_PrefabType.modelPrefab || prefabType == MB_PrefabType.prefab)
                        {
                            failedToAddAssets = true;
                        }
                        else
                        {
                            objsToCombine.Add(r.gameObject);
                            numAdded++;
                        }
                    }
                }

                if (failedToAddAssets)
                {
                    Debug.LogError("Did not add some object(s) because they are not scene objects");
                }
                Debug.Log("Added " + numAdded + " renderers");
            }
        }
Exemplo n.º 5
0
        void removeSelectedObjects()
        {
            MB3_MeshBakerRoot mom = (MB3_MeshBakerRoot)target;

            if (mom == null)
            {
                Debug.LogError("Must select a target MeshBaker");
                return;
            }
            List <GameObject>    objsToCombine = mom.GetObjectsToCombine();
            HashSet <GameObject> objectsAlreadyIncludedInBakers = new HashSet <GameObject>();
            GameObject           dontAddMe = null;
            Renderer             r         = MB_Utility.GetRenderer(mom.gameObject);

            if (r != null)
            { //make sure that this MeshBaker object is not in list
                dontAddMe = r.gameObject;
            }

            List <GameObject> objsSelectedMatchingFilter = GetFilteredList(addingObjects: false);

            Debug.Log("Matching filter " + objsSelectedMatchingFilter.Count);
            List <GameObject> objsToRemove = new List <GameObject>();

            for (int i = 0; i < objsSelectedMatchingFilter.Count; i++)
            {
                if (objsToCombine.Contains(objsSelectedMatchingFilter[i]))
                {
                    objsToRemove.Add(objsSelectedMatchingFilter[i]);
                }
            }

            MBVersionEditor.RegisterUndo(mom, "Remove Objects");
            for (int i = 0; i < objsToRemove.Count; i++)
            {
                objsToCombine.Remove(objsToRemove[i]);
            }

            SerializedObject so = new SerializedObject(mom);

            so.SetIsDifferentCacheDirty();
            Debug.Log("Removed " + objsToRemove.Count + " objects from " + mom.name);
            helpBoxString += String.Format("\nRemoved {0} objects from {1}", objsToRemove.Count, mom.name);
        }
Exemplo n.º 6
0
    void addSelectedObjects()
    {
        MB3_MeshBakerRoot mom = (MB3_MeshBakerRoot)target;

        if (mom == null)
        {
            Debug.LogError("Must select a target MeshBaker to add objects to");
            return;
        }
        List <GameObject> newMomObjs = GetFilteredList();

        MBVersionEditor.RegisterUndo(mom, "Add Objects");
        List <GameObject> momObjs = mom.GetObjectsToCombine();
        int numAdded = 0;

        for (int i = 0; i < newMomObjs.Count; i++)
        {
            if (!momObjs.Contains(newMomObjs[i]))
            {
                momObjs.Add(newMomObjs[i]);
                numAdded++;
            }
        }
        SerializedObject so = new SerializedObject(mom);

        so.SetIsDifferentCacheDirty();

        if (numAdded == 0)
        {
            Debug.LogWarning("Added 0 objects. Make sure some or all objects are selected in the hierarchy view. Also check ths 'Only Static Objects', 'Using Material' and 'Using Shader' settings");
        }
        else
        {
            Debug.Log("Added " + numAdded + " objects to " + mom.name);
        }
    }
Exemplo n.º 7
0
    public static bool DoCombinedValidate(MB3_MeshBakerRoot mom, MB_ObjsToCombineTypes objToCombineType, MB2_EditorMethodsInterface editorMethods, MB2_ValidationLevel validationLevel)
    {
        if (mom.textureBakeResults == null)
        {
            Debug.LogError("Need to set Texture Bake Result on " + mom);
            return(false);
        }
        if (mom is MB3_MeshBakerCommon)
        {
            MB3_MeshBakerCommon momMB = (MB3_MeshBakerCommon)mom;
            MB3_TextureBaker    tb    = momMB.GetTextureBaker();
            if (tb != null && tb.textureBakeResults != mom.textureBakeResults)
            {
                Debug.LogWarning("Texture Bake Result on this component is not the same as the Texture Bake Result on the MB3_TextureBaker.");
            }
        }

        Dictionary <int, MB_Utility.MeshAnalysisResult> meshAnalysisResultCache = null;

        if (validationLevel == MB2_ValidationLevel.robust)
        {
            meshAnalysisResultCache = new Dictionary <int, MB_Utility.MeshAnalysisResult>();
        }
        List <GameObject> objsToMesh = mom.GetObjectsToCombine();

        for (int i = 0; i < objsToMesh.Count; i++)
        {
            GameObject go = objsToMesh[i];
            if (go == null)
            {
                Debug.LogError("The list of objects to combine contains a null at position." + i + " Select and use [shift] delete to remove");
                return(false);
            }
            for (int j = i + 1; j < objsToMesh.Count; j++)
            {
                if (objsToMesh[i] == objsToMesh[j])
                {
                    Debug.LogError("The list of objects to combine contains duplicates at " + i + " and " + j);
                    return(false);
                }
            }
            if (MB_Utility.GetGOMaterials(go).Length == 0)
            {
                Debug.LogError("Object " + go + " in the list of objects to be combined does not have a material");
                return(false);
            }
            Mesh m = MB_Utility.GetMesh(go);
            if (m == null)
            {
                Debug.LogError("Object " + go + " in the list of objects to be combined does not have a mesh");
                return(false);
            }
            if (m != null)              //This check can be very expensive and it only warns so only do this if we are in the editor.
            {
                if (!Application.isEditor &&
                    Application.isPlaying &&
                    mom.textureBakeResults.doMultiMaterial &&
                    validationLevel >= MB2_ValidationLevel.robust)
                {
                    MB_Utility.MeshAnalysisResult mar;
                    if (!meshAnalysisResultCache.TryGetValue(m.GetInstanceID(), out mar))
                    {
                        MB_Utility.doSubmeshesShareVertsOrTris(m, ref mar);
                        meshAnalysisResultCache.Add(m.GetInstanceID(), mar);
                    }
                    if (mar.hasOverlappingSubmeshVerts)
                    {
                        Debug.LogWarning("Object " + objsToMesh[i] + " in the list of objects to combine has overlapping submeshes (submeshes share vertices). If the UVs associated with the shared vertices are important then this bake may not work. If you are using multiple materials then this object can only be combined with objects that use the exact same set of textures (each atlas contains one texture). There may be other undesirable side affects as well. Mesh Master, available in the asset store can fix overlapping submeshes.");
                    }
                }
            }
        }


        List <GameObject> objs = objsToMesh;

        if (mom is MB3_MeshBaker)
        {
            objs = mom.GetObjectsToCombine();
            //if (((MB3_MeshBaker)mom).useObjsToMeshFromTexBaker && tb != null) objs = tb.GetObjectsToCombine();
            if (objs == null || objs.Count == 0)
            {
                Debug.LogError("No meshes to combine. Please assign some meshes to combine.");
                return(false);
            }
            if (mom is MB3_MeshBaker && ((MB3_MeshBaker)mom).meshCombiner.settings.renderType == MB_RenderType.skinnedMeshRenderer)
            {
                if (!editorMethods.ValidateSkinnedMeshes(objs))
                {
                    return(false);
                }
            }
        }

        if (editorMethods != null)
        {
            editorMethods.CheckPrefabTypes(objToCombineType, objsToMesh);
        }
        return(true);
    }
Exemplo n.º 8
0
    public static bool DoCombinedValidate(MB3_MeshBakerRoot mom, MB_ObjsToCombineTypes objToCombineType, MB2_EditorMethodsInterface editorMethods)
    {
        if (mom.textureBakeResults == null)
        {
            Debug.LogError("Need to set Material Bake Result on " + mom);
            return(false);
        }
        if (!(mom is MB3_TextureBaker))
        {
            MB3_TextureBaker tb = mom.GetComponent <MB3_TextureBaker>();
            if (tb != null && tb.textureBakeResults != mom.textureBakeResults)
            {
                Debug.LogWarning("Material Bake Result on this component is not the same as the Material Bake Result on the MB3_TextureBaker.");
            }
        }

        List <GameObject> objsToMesh = mom.GetObjectsToCombine();

        for (int i = 0; i < objsToMesh.Count; i++)
        {
            GameObject go = objsToMesh[i];
            if (go == null)
            {
                Debug.LogError("The list of objects to combine contains a null at position." + i + " Select and use [shift] delete to remove");
                return(false);
            }
            for (int j = i + 1; j < objsToMesh.Count; j++)
            {
                if (objsToMesh[i] == objsToMesh[j])
                {
                    Debug.LogError("The list of objects to combine contains duplicates.");
                    return(false);
                }
            }
            if (MB_Utility.GetGOMaterials(go) == null)
            {
                Debug.LogError("Object " + go + " in the list of objects to be combined does not have a material");
                return(false);
            }
            if (MB_Utility.GetMesh(go) == null)
            {
                Debug.LogError("Object " + go + " in the list of objects to be combined does not have a mesh");
                return(false);
            }
        }

        if (mom.textureBakeResults.doMultiMaterial)
        {
            if (!validateSubmeshOverlap(mom))             //only warns currently
            {
                return(false);
            }
        }
        List <GameObject> objs = objsToMesh;

        if (mom is MB3_MeshBaker)
        {
            MB3_TextureBaker tb = mom.GetComponent <MB3_TextureBaker>();
            if (((MB3_MeshBaker)mom).useObjsToMeshFromTexBaker && tb != null)
            {
                objs = tb.objsToMesh;
            }
            if (objs == null || objs.Count == 0)
            {
                Debug.LogError("No meshes to combine. Please assign some meshes to combine.");
                return(false);
            }
            if (mom is MB3_MeshBaker && ((MB3_MeshBaker)mom).meshCombiner.renderType == MB_RenderType.skinnedMeshRenderer)
            {
                if (!editorMethods.ValidateSkinnedMeshes(objs))
                {
                    return(false);
                }
            }
        }

        if (editorMethods != null)
        {
            editorMethods.CheckPrefabTypes(objToCombineType, objsToMesh);
        }
        return(true);
    }
Exemplo n.º 9
0
	public static bool DoCombinedValidate(MB3_MeshBakerRoot mom, MB_ObjsToCombineTypes objToCombineType, MB2_EditorMethodsInterface editorMethods, MB2_ValidationLevel validationLevel){
		if (mom.textureBakeResults == null){
			Debug.LogError("Need to set Material Bake Result on " + mom);
			return false;
		}
		if (mom is MB3_MeshBakerCommon){
			MB3_MeshBakerCommon momMB = (MB3_MeshBakerCommon) mom;
			MB3_TextureBaker tb = momMB.GetTextureBaker();
			if (tb != null && tb.textureBakeResults != mom.textureBakeResults){
				Debug.LogWarning("Material Bake Result on this component is not the same as the Material Bake Result on the MB3_TextureBaker.");
			}
		}

		Dictionary<int,MB_Utility.MeshAnalysisResult> meshAnalysisResultCache = null;
		if (validationLevel == MB2_ValidationLevel.robust){
			meshAnalysisResultCache = new Dictionary<int, MB_Utility.MeshAnalysisResult>();
		}
		List<GameObject> objsToMesh = mom.GetObjectsToCombine();
		for (int i = 0; i < objsToMesh.Count; i++){
			GameObject go = objsToMesh[i];
			if (go == null){
				Debug.LogError("The list of objects to combine contains a null at position." + i + " Select and use [shift] delete to remove");
				return false;					
			}
			for (int j = i + 1; j < objsToMesh.Count; j++){
				if (objsToMesh[i] == objsToMesh[j]){
					Debug.LogError("The list of objects to combine contains duplicates at " + i + " and " + j);
					return false;	
				}
			}
			if (MB_Utility.GetGOMaterials(go) == null){
				Debug.LogError("Object " + go + " in the list of objects to be combined does not have a material");
				return false;
			}
			Mesh m = MB_Utility.GetMesh(go);
			if (m == null){
				Debug.LogError("Object " + go + " in the list of objects to be combined does not have a mesh");
				return false;
			}
			if (m != null){ //This check can be very expensive and it only warns so only do this if we are in the editor.
				if (!Application.isEditor && 
				    Application.isPlaying &&
					mom.textureBakeResults.doMultiMaterial && 
					validationLevel >= MB2_ValidationLevel.robust){
					MB_Utility.MeshAnalysisResult mar;
					if (!meshAnalysisResultCache.TryGetValue(m.GetInstanceID(),out mar)){
						MB_Utility.doSubmeshesShareVertsOrTris(m,ref mar);
						meshAnalysisResultCache.Add (m.GetInstanceID(),mar);
					}
					if (mar.hasOverlappingSubmeshVerts){
						Debug.LogWarning("Object " + objsToMesh[i] + " in the list of objects to combine has overlapping submeshes (submeshes share vertices). If the UVs associated with the shared vertices are important then this bake may not work. If you are using multiple materials then this object can only be combined with objects that use the exact same set of textures (each atlas contains one texture). There may be other undesirable side affects as well. Mesh Master, available in the asset store can fix overlapping submeshes.");	
					}
				}
			}
		}

		
		List<GameObject> objs = objsToMesh;
		
		if (mom is MB3_MeshBaker)
		{
			objs = mom.GetObjectsToCombine();
			//if (((MB3_MeshBaker)mom).useObjsToMeshFromTexBaker && tb != null) objs = tb.GetObjectsToCombine(); 
			if (objs == null || objs.Count == 0)
			{
				Debug.LogError("No meshes to combine. Please assign some meshes to combine.");
				return false;
			}
			if (mom is MB3_MeshBaker && ((MB3_MeshBaker)mom).meshCombiner.renderType == MB_RenderType.skinnedMeshRenderer){
				if (!editorMethods.ValidateSkinnedMeshes(objs))
				{
					return false;
				}
			}
		}
		
		if (editorMethods != null){
			editorMethods.CheckPrefabTypes(objToCombineType, objsToMesh);
		}
		return true;
	}
Exemplo n.º 10
0
    public static bool DoCombinedValidate(MB3_MeshBakerRoot mom, MB_ObjsToCombineTypes objToCombineType, MB2_EditorMethodsInterface editorMethods, MB2_ValidationLevel validationLevel)
    {
        if (mom.textureBakeResults == null)
        {
            Debug.LogError("Need to set Material Bake Result on " + mom);
            return(false);
        }
        if (mom is MB3_MeshBakerCommon)
        {
            MB3_MeshBakerCommon mb3_MeshBakerCommon = (MB3_MeshBakerCommon)mom;
            MB3_TextureBaker    textureBaker        = mb3_MeshBakerCommon.GetTextureBaker();
            if (textureBaker != null && textureBaker.textureBakeResults != mom.textureBakeResults)
            {
                Debug.LogWarning("Material Bake Result on this component is not the same as the Material Bake Result on the MB3_TextureBaker.");
            }
        }
        Dictionary <int, MB_Utility.MeshAnalysisResult> dictionary = null;

        if (validationLevel == MB2_ValidationLevel.robust)
        {
            dictionary = new Dictionary <int, MB_Utility.MeshAnalysisResult>();
        }
        List <GameObject> objectsToCombine = mom.GetObjectsToCombine();

        for (int i = 0; i < objectsToCombine.Count; i++)
        {
            GameObject gameObject = objectsToCombine[i];
            if (gameObject == null)
            {
                Debug.LogError("The list of objects to combine contains a null at position." + i + " Select and use [shift] delete to remove");
                return(false);
            }
            for (int j = i + 1; j < objectsToCombine.Count; j++)
            {
                if (objectsToCombine[i] == objectsToCombine[j])
                {
                    Debug.LogError(string.Concat(new object[]
                    {
                        "The list of objects to combine contains duplicates at ",
                        i,
                        " and ",
                        j
                    }));
                    return(false);
                }
            }
            if (MB_Utility.GetGOMaterials(gameObject) == null)
            {
                Debug.LogError("Object " + gameObject + " in the list of objects to be combined does not have a material");
                return(false);
            }
            Mesh mesh = MB_Utility.GetMesh(gameObject);
            if (mesh == null)
            {
                Debug.LogError("Object " + gameObject + " in the list of objects to be combined does not have a mesh");
                return(false);
            }
            if (mesh != null && !Application.isEditor && Application.isPlaying && mom.textureBakeResults.doMultiMaterial && validationLevel >= MB2_ValidationLevel.robust)
            {
                MB_Utility.MeshAnalysisResult value;
                if (!dictionary.TryGetValue(mesh.GetInstanceID(), out value))
                {
                    MB_Utility.doSubmeshesShareVertsOrTris(mesh, ref value);
                    dictionary.Add(mesh.GetInstanceID(), value);
                }
                if (value.hasOverlappingSubmeshVerts)
                {
                    Debug.LogWarning("Object " + objectsToCombine[i] + " in the list of objects to combine has overlapping submeshes (submeshes share vertices). If the UVs associated with the shared vertices are important then this bake may not work. If you are using multiple materials then this object can only be combined with objects that use the exact same set of textures (each atlas contains one texture). There may be other undesirable side affects as well. Mesh Master, available in the asset store can fix overlapping submeshes.");
                }
            }
        }
        if (mom is MB3_MeshBaker)
        {
            List <GameObject> objectsToCombine2 = mom.GetObjectsToCombine();
            if (objectsToCombine2 == null || objectsToCombine2.Count == 0)
            {
                Debug.LogError("No meshes to combine. Please assign some meshes to combine.");
                return(false);
            }
            if (mom is MB3_MeshBaker && ((MB3_MeshBaker)mom).meshCombiner.renderType == MB_RenderType.skinnedMeshRenderer && !editorMethods.ValidateSkinnedMeshes(objectsToCombine2))
            {
                return(false);
            }
        }
        if (editorMethods != null)
        {
            editorMethods.CheckPrefabTypes(objToCombineType, objectsToCombine);
        }
        return(true);
    }
Exemplo n.º 11
0
    public static bool DoCombinedValidate(MB3_MeshBakerRoot mom, MB_ObjsToCombineTypes objToCombineType, MB2_EditorMethodsInterface editorMethods, MB2_ValidationLevel validationLevel)
    {
        if (mom.textureBakeResults == null)
        {
            Debug.LogError("Need to set Texture Bake Result on " + mom);
            return(false);
        }
        if (mom is MB3_MeshBakerCommon)
        {
            MB3_MeshBakerCommon momMB = (MB3_MeshBakerCommon)mom;
            MB3_TextureBaker    tb    = momMB.GetTextureBaker();
            if (tb != null && tb.textureBakeResults != mom.textureBakeResults)
            {
                Debug.LogWarning("Texture Bake Result on this component is not the same as the Texture Bake Result on the MB3_TextureBaker.");
            }
        }

        Dictionary <int, MB_Utility.MeshAnalysisResult> meshAnalysisResultCache = null;

        if (validationLevel == MB2_ValidationLevel.robust)
        {
            meshAnalysisResultCache = new Dictionary <int, MB_Utility.MeshAnalysisResult>();
        }
        List <GameObject>             objsToMesh  = mom.GetObjectsToCombine();
        Dictionary <string, Material> matName2Mat = new Dictionary <string, Material>();

        for (int i = 0; i < objsToMesh.Count; i++)
        {
            GameObject go = objsToMesh[i];
            if (go == null)
            {
                Debug.LogError("The list of objects to combine contains a null at position." + i + " Select and use [shift] delete to remove");
                return(false);
            }
            for (int j = i + 1; j < objsToMesh.Count; j++)
            {
                if (objsToMesh[i] == objsToMesh[j])
                {
                    Debug.LogError("The list of objects to combine contains duplicates at " + i + " and " + j);
                    return(false);
                }
            }

            Material[] mats = MB_Utility.GetGOMaterials(go);
            if (mats.Length == 0)
            {
                Debug.LogError("Object " + go + " in the list of objects to be combined does not have a material");
                return(false);
            }
            Mesh m = MB_Utility.GetMesh(go);
            if (m == null)
            {
                Debug.LogError("Object " + go + " in the list of objects to be combined does not have a mesh");
                return(false);
            }
            if (m != null)              //This check can be very expensive and it only warns so only do this if we are in the editor.
            {
                if (!Application.isEditor &&
                    Application.isPlaying &&
                    mom.textureBakeResults.doMultiMaterial &&
                    validationLevel >= MB2_ValidationLevel.robust)
                {
                    MB_Utility.MeshAnalysisResult mar;
                    if (!meshAnalysisResultCache.TryGetValue(m.GetInstanceID(), out mar))
                    {
                        MB_Utility.doSubmeshesShareVertsOrTris(m, ref mar);
                        meshAnalysisResultCache.Add(m.GetInstanceID(), mar);
                    }
                    if (mar.hasOverlappingSubmeshVerts)
                    {
                        Debug.LogWarning("Object " + objsToMesh[i] + " in the list of objects to combine has overlapping submeshes (submeshes share vertices). If the UVs associated with the shared vertices are important then this bake may not work. If you are using multiple materials then this object can only be combined with objects that use the exact same set of textures (each atlas contains one texture). There may be other undesirable side affects as well. Mesh Master, available in the asset store can fix overlapping submeshes.");
                    }
                }
            }

            if (MBVersion.IsUsingAddressables())
            {
                HashSet <string> materialsWithDuplicateNames = new HashSet <string>();
                for (int matIdx = 0; matIdx < mats.Length; matIdx++)
                {
                    if (mats[matIdx] != null)
                    {
                        if (matName2Mat.ContainsKey(mats[matIdx].name))
                        {
                            if (mats[matIdx] != matName2Mat[mats[matIdx].name])
                            {
                                // This is an error. If using addressables we consider materials that have the same name to be the same material when baking at runtime.
                                // Two different material must NOT have the same name.
                                materialsWithDuplicateNames.Add(mats[matIdx].name);
                            }
                        }
                        else
                        {
                            matName2Mat.Add(mats[matIdx].name, mats[matIdx]);
                        }
                    }
                }

                if (materialsWithDuplicateNames.Count > 0)
                {
                    String[] stringArray = new String[materialsWithDuplicateNames.Count];
                    materialsWithDuplicateNames.CopyTo(stringArray);
                    string matsWithSameName = string.Join(",", stringArray);
                    Debug.LogError("The source objects use different materials that have the same name (" + matsWithSameName + "). " +
                                   "If using addressables, materials with the same name are considered to be the same material when baking meshes at runtime. " +
                                   "If you want to use this Material Bake Result at runtime then all source materials must have distinct names. Baking in edit-mode will still work.");
                }
            }
        }


        List <GameObject> objs = objsToMesh;

        if (mom is MB3_MeshBaker)
        {
            objs = mom.GetObjectsToCombine();
            //if (((MB3_MeshBaker)mom).useObjsToMeshFromTexBaker && tb != null) objs = tb.GetObjectsToCombine();
            if (objs == null || objs.Count == 0)
            {
                Debug.LogError("No meshes to combine. Please assign some meshes to combine.");
                return(false);
            }
            if (mom is MB3_MeshBaker && ((MB3_MeshBaker)mom).meshCombiner.settings.renderType == MB_RenderType.skinnedMeshRenderer)
            {
                if (!editorMethods.ValidateSkinnedMeshes(objs))
                {
                    return(false);
                }
            }
        }

        if (editorMethods != null)
        {
            editorMethods.CheckPrefabTypes(objToCombineType, objsToMesh);
        }
        return(true);
    }