static void ImportMesh(string sourcePath, string destPath) { try { MegascansUtilities.UpdateProgressBar(1.0f, "Importing Megascans Asset", "Importing Mesh..."); if (File.Exists(sourcePath)) { File.Copy(sourcePath, destPath, true); AssetDatabase.ImportAsset(destPath); } } catch (Exception ex) { Debug.Log("Exception::MegascansMeshUtils::Importing Mesh:: " + ex.ToString()); MegascansUtilities.HideProgressBar(); } }
static GameObject SavePrefab(GameObject prefabGo, string savePath, bool addAssetToScene = false) { try { //Set all children objects of the prefab to static Transform[] allChildren = prefabGo.GetComponentsInChildren <Transform>(); foreach (Transform child in allChildren) { child.gameObject.isStatic = true; } GameObject newPrefabObject = prefabGo; MegascansUtilities.UpdateProgressBar(1.0f, "Importing Megascans Asset", "Creating Prefab..."); #if UNITY_5 || UNITY_2017 || UNITY_2018 UnityEngine.Object existingPrefab = AssetDatabase.LoadAssetAtPath(savePath, typeof(UnityEngine.Object)); if (!existingPrefab) { PrefabUtility.CreatePrefab(savePath, prefabGo); } else { PrefabUtility.ReplacePrefab(prefabGo, existingPrefab, ReplacePrefabOptions.ReplaceNameBased); } #else PrefabUtility.SaveAsPrefabAsset(prefabGo, savePath); #endif DestroyImmediate(prefabGo); if (addAssetToScene) { UnityEngine.Object prefabObject = AssetDatabase.LoadAssetAtPath <UnityEngine.Object>(savePath); newPrefabObject = (GameObject)PrefabUtility.InstantiatePrefab(prefabObject); newPrefabObject.isStatic = true; } return(newPrefabObject); } catch (Exception ex) { Debug.Log("Exception::MegascansMeshUtils::Saving Prefab:: " + ex.ToString()); MegascansUtilities.HideProgressBar(); return(null); } }
static GameObject SavePrefab(GameObject prefabGo, string savePath, bool addAssetToScene = false) { try { GameObject newPrefabObject = prefabGo; MegascansUtilities.UpdateProgressBar(1.0f, "Importing Megascans Asset", "Creating Prefab..."); #if UNITY_2019 PrefabUtility.SaveAsPrefabAsset(prefabGo, savePath); DestroyImmediate(prefabGo); if (addAssetToScene) { UnityEngine.Object prefabObject = AssetDatabase.LoadAssetAtPath <UnityEngine.Object>(savePath); newPrefabObject = (GameObject)PrefabUtility.InstantiatePrefab(prefabObject); } #else UnityEngine.Object existingPrefab = AssetDatabase.LoadAssetAtPath(savePath, typeof(UnityEngine.Object)); if (!existingPrefab) { PrefabUtility.CreatePrefab(savePath, prefabGo); } else { PrefabUtility.ReplacePrefab(prefabGo, existingPrefab, ReplacePrefabOptions.ReplaceNameBased); } if (!addAssetToScene) { DestroyImmediate(prefabGo); } #endif return(newPrefabObject); } catch (Exception ex) { Debug.Log("Exception::MegascansMeshUtils::Saving Prefab:: " + ex.ToString()); MegascansUtilities.HideProgressBar(); return(null); } }
void ProcessTextures(JObject objectList) { texPath = MegascansUtilities.ValidateFolderCreate(path, "Textures"); matPath = Path.Combine(MegascansUtilities.ValidateFolderCreate(path, "Materials"), folderNamingConvention); if (!(plant && hasBillboardLODOnly)) { MegascansUtilities.UpdateProgressBar(1.0f, "Processing Asset " + assetName, "Creating material..."); finalMat = MegascansMaterialUtils.CreateMaterial(shaderType, matPath, isAlembic, dispType, texPack); ImportAllTextures(finalMat, (JArray)objectList["components"]); ImportAllTextures(finalMat, (JArray)objectList["packedTextures"]); } if (plant && hasBillboardLOD) { texPath = MegascansUtilities.ValidateFolderCreate(texPath, "Billboard"); matPath += "_Billboard"; MegascansUtilities.UpdateProgressBar(1.0f, "Processing Asset " + assetName, "Creating material..."); billboardMat = MegascansMaterialUtils.CreateMaterial(shaderType, matPath, isAlembic, dispType, texPack); ImportAllTextures(billboardMat, (JArray)objectList["components-billboard"]); ImportAllTextures(billboardMat, (JArray)objectList["packed-billboard"]); } }
void ImportAllTextures(Material mat, JArray texturesList) { try { List <string> typesOfTexturesAvailable = new List <string>(); for (int i = 0; i < texturesList.Count; i++) { typesOfTexturesAvailable.Add((string)texturesList[i]["type"]); } string destTexPath; Texture2D tex; for (int i = 0; i < texturesList.Count; i++) { mapName = (string)texturesList[i]["type"]; MegascansUtilities.UpdateProgressBar(1.0f, "Processing Asset " + assetName, "Importing texture: " + mapName); if ((string)texturesList[i]["type"] == "albedo" || ((string)texturesList[i]["type"] == "diffuse" && !typesOfTexturesAvailable.Contains("albedo"))) { destTexPath = Path.Combine(texPath, (string)texturesList[i]["nameOverride"]); MegascansTextureProcessor texPrcsr = new MegascansTextureProcessor((string)texturesList[i]["path"], destTexPath); tex = texPrcsr.ImportTexture(); mat.SetTexture("_MainTex", tex); mat.SetTexture("_BaseColorMap", tex); if (shaderType == 1) { mat.SetTexture("_BaseMap", tex); mat.SetColor("_BaseColor", Color.white); } if (MegascansUtilities.AlbedoHasOpacity((JObject)texturesList[i]["channelsData"])) { float alphaCutoff = 0.33f; texPrcsr.AdjustAlphaCutoff(); if (shaderType > 0) { mat.SetFloat("_AlphaClip", 1); mat.SetFloat("_Cutoff", 0.1f); mat.SetFloat("_Mode", 1); mat.SetFloat("_Cull", 0); mat.EnableKeyword("_ALPHATEST_ON"); } else { mat.SetInt("_AlphaCutoffEnable", 1); mat.SetFloat("_AlphaCutoff", alphaCutoff); mat.SetInt("_DoubleSidedEnable", 1); mat.SetOverrideTag("RenderType", "TransparentCutout"); mat.SetInt("_ZTestGBuffer", (int)UnityEngine.Rendering.CompareFunction.Equal); mat.SetInt("_CullMode", (int)UnityEngine.Rendering.CullMode.Off); mat.SetInt("_CullModeForward", (int)UnityEngine.Rendering.CullMode.Back); mat.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.One); mat.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.Zero); mat.SetInt("_ZWrite", 1); mat.renderQueue = 2450; mat.SetInt("_ZTestGBuffer", (int)UnityEngine.Rendering.CompareFunction.Equal); mat.EnableKeyword("_ALPHATEST_ON"); mat.EnableKeyword("_DOUBLESIDED_ON"); mat.DisableKeyword("_BLENDMODE_ALPHA"); mat.DisableKeyword("_SURFACE_TYPE_TRANSPARENT"); } } } else if ((string)texturesList[i]["type"] == "specular") { if (texPack > 0) { destTexPath = Path.Combine(texPath, (string)texturesList[i]["nameOverride"]); MegascansTextureProcessor texPrcsr = new MegascansTextureProcessor((string)texturesList[i]["path"], destTexPath); tex = texPrcsr.ImportTexture(); mat.SetTexture("_SpecGlossMap", tex); mat.SetTexture("_SpecularColorMap", tex); mat.SetColor("_SpecColor", new UnityEngine.Color(1.0f, 1.0f, 1.0f)); mat.SetColor("_SpecularColor", new UnityEngine.Color(1.0f, 1.0f, 1.0f)); mat.SetFloat("_WorkflowMode", 0); mat.SetFloat("_MaterialID", 4); mat.EnableKeyword("_METALLICSPECGLOSSMAP"); mat.EnableKeyword("_SPECGLOSSMAP"); mat.EnableKeyword("_SPECULAR_SETUP"); mat.EnableKeyword("_SPECULARCOLORMAP"); mat.EnableKeyword("_MATERIAL_FEATURE_SPECULAR_COLOR"); } } else if ((string)texturesList[i]["type"] == "masks") { if (texPack < 1 || shaderType < 1) { destTexPath = Path.Combine(texPath, (string)texturesList[i]["nameOverride"]); MegascansTextureProcessor texPrcsr = new MegascansTextureProcessor((string)texturesList[i]["path"], destTexPath, false, false); tex = texPrcsr.ImportTexture(); mat.SetTexture("_MaskMap", tex); mat.SetTexture("_MetallicGlossMap", tex); mat.EnableKeyword("_MASKMAP"); mat.SetFloat("_MaterialID", 1); mat.EnableKeyword("_METALLICSPECGLOSSMAP"); mat.EnableKeyword("_METALLICGLOSSMAP"); bool hasMetalness; bool hasAO; bool hasGloss; MegascansUtilities.MaskMapComponents((JObject)texturesList[i]["channelsData"], out hasMetalness, out hasAO, out hasGloss); if (!hasMetalness) { mat.SetFloat("_Metallic", 1.0f); } if (hasAO) { mat.SetTexture("_OcclusionMap", tex); mat.EnableKeyword("_OCCLUSIONMAP"); } } } else if ((string)texturesList[i]["type"] == "normal") { string normalMapPath = (string)texturesList[i]["path"]; if (activeLOD == "high" && !normalMapPath.Contains("NormalBump")) { for (int x = 0; x < 10; x++) { string n = normalMapPath.Replace("_LOD" + x.ToString(), "Bump"); if (File.Exists(n)) { normalMapPath = n; break; } } if (normalMapPath.Contains("NormalBump")) { continue; } } destTexPath = Path.Combine(texPath, (string)texturesList[i]["nameOverride"]); MegascansTextureProcessor texPrcsr = new MegascansTextureProcessor(normalMapPath, destTexPath, true, false); tex = texPrcsr.ImportTexture(); mat.SetTexture("_BumpMap", tex); mat.SetTexture("_NormalMap", tex); mat.EnableKeyword("_NORMALMAP_TANGENT_SPACE"); mat.EnableKeyword("_NORMALMAP"); } else if ((string)texturesList[i]["type"] == "ao" && texPack > 0) { destTexPath = Path.Combine(texPath, (string)texturesList[i]["nameOverride"]); MegascansTextureProcessor texPrcsr = new MegascansTextureProcessor((string)texturesList[i]["path"], destTexPath, false, false); tex = texPrcsr.ImportTexture(); mat.SetTexture("_OcclusionMap", tex); mat.EnableKeyword("_OCCLUSIONMAP"); } else if ((string)texturesList[i]["type"] == "displacement") { if (dispType > 0) { destTexPath = Path.Combine(texPath, (string)texturesList[i]["nameOverride"]); MegascansTextureProcessor texPrcsr = new MegascansTextureProcessor((string)texturesList[i]["path"], destTexPath, false, false); tex = texPrcsr.ImportTexture(); mat.SetTexture("_HeightMap", tex); mat.SetTexture("_ParallaxMap", tex); mat.EnableKeyword("_DISPLACEMENT_LOCK_TILING_SCALE"); if (shaderType == 0) { mat.EnableKeyword("_HEIGHTMAP"); } if (dispType == 1) { mat.EnableKeyword("_VERTEX_DISPLACEMENT"); mat.EnableKeyword("_VERTEX_DISPLACEMENT_LOCK_OBJECT_SCALE"); } else if (dispType == 2) { mat.EnableKeyword("_PARALLAXMAP"); mat.EnableKeyword("_PIXEL_DISPLACEMENT"); mat.EnableKeyword("_PIXEL_DISPLACEMENT_LOCK_OBJECT_SCALE"); } } } else if ((string)texturesList[i]["type"] == "translucency") { destTexPath = Path.Combine(texPath, (string)texturesList[i]["nameOverride"]); MegascansTextureProcessor texPrcsr = new MegascansTextureProcessor((string)texturesList[i]["path"], destTexPath); tex = texPrcsr.ImportTexture(); mat.SetTexture("_SubsurfaceMaskMap", tex); mat.EnableKeyword("_SUBSURFACE_MASK_MAP"); mat.SetInt("_DiffusionProfile", 1); mat.SetFloat("_EnableSubsurfaceScattering", 1); if (!typesOfTexturesAvailable.Contains("transmission")) { mat.SetTexture("_ThicknessMap", tex); mat.EnableKeyword("_THICKNESSMAP"); } if (plant) { mat.SetInt("_DiffusionProfile", 2); mat.SetFloat("_CoatMask", 0.0f); mat.SetInt("_EnableWind", 1); mat.EnableKeyword("_VERTEX_WIND"); } MegascansMaterialUtils.AddSSSSettings(mat, shaderType); } else if ((string)texturesList[i]["type"] == "transmission") { destTexPath = Path.Combine(texPath, (string)texturesList[i]["nameOverride"]); MegascansTextureProcessor texPrcsr = new MegascansTextureProcessor((string)texturesList[i]["path"], destTexPath, false, false); tex = texPrcsr.ImportTexture(); mat.SetTexture("_ThicknessMap", tex); mat.EnableKeyword("_THICKNESSMAP"); mat.SetInt("_DiffusionProfile", 2); MegascansMaterialUtils.AddSSSSettings(mat, shaderType); } else if (importAllTextures) { mapName = (string)texturesList[i]["type"]; string mapPath = (string)texturesList[i]["path"]; string otherTexFolder = MegascansUtilities.ValidateFolderCreate(texPath, "Others"); destTexPath = Path.Combine(otherTexFolder, (string)texturesList[i]["nameOverride"]); MegascansTextureProcessor texPrcsr = new MegascansTextureProcessor(mapPath, destTexPath); tex = texPrcsr.ImportTexture(); } } } catch (Exception ex) { Debug.Log("Exception::MegascansImporter::ImportAllTextures:: " + ex.ToString()); MegascansUtilities.HideProgressBar(); } }
/// <summary> /// Previous version of the importer would loop through a list of texture paths, and use a bunch of if-statements and do things accordingly. /// This version just takes in every texture path and if it's not null, does the thing. Less looping, better overall performance. /// </summary> /// <param name="albedo"></param> /// <param name="opacity"></param> /// <param name="normals"></param> /// <param name="metallic"></param> /// <param name="specular"></param> /// <param name="AO"></param> /// <param name="gloss"></param> /// <param name="displacement"></param> /// <param name="roughness"></param> /// <param name="translucency"></param> Material ReadWriteAllTextures(string albedo, string opacity, string normals, string metallic, string specular, string AO, string gloss, string displacement, string roughness, string translucency) { try { Material mat = CreateMaterial(); if (mat == null) { return(null); } //create a new work thread for each texture to be processed. //Pack the opacity into the alpha channel of albedo if it exists. string texMapName = (string)mapNames["Albedo"]; tempTexName = texPath.Contains("$mapName")? texPath.Replace("$mapName", texMapName): texPath + texMapName; string p = tempTexName + ".png"; mapName = opacity != null ? "Albedo + Alpha" : "Albedo"; MegascansUtilities.UpdateProgressBar(1.0f, "Processing Asset " + assetName, "Importing texture: " + mapName); Texture2D tex = MegascansImageUtils.PackTextures(albedo, opacity, p); mat.SetTexture("_MainTex", tex); mat.SetTexture("_BaseColorMap", tex); if (shaderType == 1) { mat.SetTexture("_BaseMap", tex); mat.SetColor("_BaseColor", Color.white); } if (opacity != null) { if (shaderType > 0) { mat.SetFloat("_AlphaClip", 1); mat.SetFloat("_Mode", 1); mat.SetFloat("_Cull", 1); mat.EnableKeyword("_ALPHATEST_ON"); } else { mat.SetInt("_AlphaCutoffEnable", 1); mat.SetFloat("_AlphaCutoff", 0.333f); mat.SetInt("_DoubleSidedEnable", 1); mat.SetOverrideTag("RenderType", "TransparentCutout"); mat.SetInt("_ZTestGBuffer", (int)UnityEngine.Rendering.CompareFunction.Equal); mat.SetInt("_CullMode", (int)UnityEngine.Rendering.CullMode.Off); mat.SetInt("_CullModeForward", (int)UnityEngine.Rendering.CullMode.Back); mat.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.One); mat.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.Zero); mat.SetInt("_ZWrite", 1); mat.renderQueue = 2450; mat.SetInt("_ZTestGBuffer", (int)UnityEngine.Rendering.CompareFunction.Equal); mat.EnableKeyword("_ALPHATEST_ON"); mat.EnableKeyword("_DOUBLESIDED_ON"); mat.DisableKeyword("_BLENDMODE_ALPHA"); mat.DisableKeyword("_SURFACE_TYPE_TRANSPARENT"); } } //test to see if gloss is absent but roughness is present... bool useRoughness = (gloss == null && roughness != null); if (texPack < 1 || shaderType < 1) { mapName = "Masks"; MegascansUtilities.UpdateProgressBar(1.0f, "Processing Asset " + assetName, "Importing texture: " + mapName); tempTexName = texPath.Contains("$mapName") ? texPath.Replace("$mapName", "Masks"): texPath + "Masks"; p = tempTexName + ".png"; mat.SetFloat("_Metallic", 1.0f); tex = MegascansImageUtils.PackTextures(metallic, AO, displacement, useRoughness ? roughness : gloss, p, useRoughness); mat.SetTexture("_MaskMap", tex); mat.EnableKeyword("_MASKMAP"); mat.SetFloat("_MaterialID", 1); mat.SetTexture("_MetallicGlossMap", tex); mat.EnableKeyword("_METALLICSPECGLOSSMAP"); mat.EnableKeyword("_METALLICGLOSSMAP"); } //do we need to process a specular map? if (texPack > 0 && specular != null) { texMapName = (string)mapNames["Specular"]; mapName = "Specular + Gloss"; MegascansUtilities.UpdateProgressBar(1.0f, "Processing Asset " + assetName, "Importing texture: " + mapName); tempTexName = texPath.Contains("$mapName") ? texPath.Replace("$mapName", texMapName): texPath + texMapName; p = tempTexName + ".png"; tex = MegascansImageUtils.PackTextures(specular, useRoughness ? roughness : gloss, p, useRoughness); mat.SetTexture("_SpecGlossMap", tex); mat.SetColor("_SpecColor", new UnityEngine.Color(1.0f, 1.0f, 1.0f)); mat.SetColor("_SpecularColor", new UnityEngine.Color(1.0f, 1.0f, 1.0f)); mat.SetFloat("_WorkflowMode", 0); mat.SetFloat("_MaterialID", 4); mat.SetTexture("_SpecularColorMap", tex); mat.EnableKeyword("_METALLICSPECGLOSSMAP"); mat.EnableKeyword("_SPECGLOSSMAP"); mat.EnableKeyword("_SPECULAR_SETUP"); mat.EnableKeyword("_SPECULARCOLORMAP"); mat.EnableKeyword("_MATERIAL_FEATURE_SPECULAR_COLOR"); } //handle any textures which can just be converted in place. if (normals != null) { texMapName = (string)mapNames["Normal"]; mapName = "Normals"; MegascansUtilities.UpdateProgressBar(1.0f, "Processing Asset " + assetName, "Importing texture: " + mapName); tempTexName = texPath.Contains("$mapName") ? texPath.Replace("$mapName", texMapName): texPath + texMapName; p = tempTexName + ".png"; MegascansImageUtils.CreateTexture(normals, p); tex = MegascansImageUtils.TextureImportSetup(p, true, false); mat.SetTexture("_BumpMap", tex); mat.SetTexture("_NormalMap", tex); mat.EnableKeyword("_NORMALMAP_TANGENT_SPACE"); mat.EnableKeyword("_NORMALMAP"); mapName = "Normals_Terrain"; tempTexName = texPath.Contains("$mapName") ? texPath.Replace("$mapName", texMapName + "_Terrain"): texPath + texMapName + "_Terrain"; p = tempTexName + ".png"; if (generateTerrainNormal && type.ToLower().Contains("surface")) { MegascansImageUtils.ImportTerrainNormal(normals, p); } } if (displacement != null && dispType > 0) { texMapName = (string)mapNames["Displacement"]; mapName = "Displacement"; MegascansUtilities.UpdateProgressBar(1.0f, "Processing Asset " + assetName, "Importing texture: " + mapName); tempTexName = texPath.Contains("$mapName") ? texPath.Replace("$mapName", texMapName): texPath + texMapName; p = tempTexName + ".png"; MegascansImageUtils.CreateTexture(displacement, p); tex = MegascansImageUtils.TextureImportSetup(p, false, false); mat.SetTexture("_HeightMap", tex); mat.SetTexture("_ParallaxMap", tex); mat.EnableKeyword("_DISPLACEMENT_LOCK_TILING_SCALE"); if (dispType == 1) { mat.EnableKeyword("_VERTEX_DISPLACEMENT"); mat.EnableKeyword("_VERTEX_DISPLACEMENT_LOCK_OBJECT_SCALE"); } if (dispType == 2) { mat.EnableKeyword("_PIXEL_DISPLACEMENT"); mat.EnableKeyword("_PIXEL_DISPLACEMENT_LOCK_OBJECT_SCALE"); } } //occlusion may or may not need to be packed, depending on the shader used. if (shaderType > 1 && AO != null) { texMapName = (string)mapNames["AO"]; mapName = "AO"; MegascansUtilities.UpdateProgressBar(1.0f, "Processing Asset " + assetName, "Importing texture: " + mapName); tempTexName = texPath.Contains("$mapName") ? texPath.Replace("$mapName", texMapName): texPath + texMapName; p = tempTexName + ".png"; MegascansImageUtils.CreateTexture(AO, p); tex = MegascansImageUtils.TextureImportSetup(p, false, false); mat.SetTexture("_OcclusionMap", tex); mat.EnableKeyword("_OCCLUSIONMAP"); } if (translucency != null) { texMapName = (string)mapNames["Translucency"]; mapName = "Translucency"; MegascansUtilities.UpdateProgressBar(1.0f, "Processing Asset " + assetName, "Importing texture: " + mapName); tempTexName = texPath.Contains("$mapName") ? texPath.Replace("$mapName", texMapName): texPath + texMapName; p = tempTexName + ".png"; tex = MegascansImageUtils.PackTextures(translucency, translucency, translucency, null, p); mat.SetInt("_MaterialID", 0); mat.SetInt("_DiffusionProfile", 1); mat.SetFloat("_EnableSubsurfaceScattering", 1); mat.SetTexture("_SubsurfaceMaskMap", tex); mat.SetTexture("_ThicknessMap", tex); if (plant) { mat.SetInt("_DiffusionProfile", 2); mat.SetFloat("_CoatMask", 0.0f); mat.SetInt("_EnableWind", 1); mat.EnableKeyword("_VERTEX_WIND"); } mat.EnableKeyword("_SUBSURFACE_MASK_MAP"); mat.EnableKeyword("_THICKNESSMAP"); mat.EnableKeyword("_MATERIAL_FEATURE_TRANSMISSION"); } return(mat); } catch (Exception ex) { Debug.Log("Exception: " + ex.ToString()); MegascansUtilities.HideProgressBar(); return(null); } }
/// <summary> /// Creates materials needed for the asset. /// </summary> /// <returns></returns> Material CreateMaterial() { MegascansUtilities.UpdateProgressBar(1.0f, "Processing Asset " + assetName, "Creating material..."); if ((shaderType == 0 || shaderType == 1) && isAlembic) { Debug.Log("Alembic files are not supported in LWRP/HDRP. Please change your export file format in Bridge or change your SRP in Unity."); return(null); } try { string rp = matPath + ".mat"; Material mat = (Material)AssetDatabase.LoadAssetAtPath(rp, typeof(Material)); if (!mat) { mat = new Material(Shader.Find("Standard")); AssetDatabase.CreateAsset(mat, rp); AssetDatabase.Refresh(); if (shaderType < 1) { mat.shader = Shader.Find("HDRenderPipeline/Lit"); #if UNITY_2018_3 || UNITY_2019 mat.shader = Shader.Find("HDRP/Lit"); #endif mat.SetInt("_DisplacementMode", dispType); } if (shaderType > 0) { if (MegascansUtilities.isLegacy()) { mat.shader = Shader.Find("LightweightPipeline/Standard (Physically Based)"); } else { mat.shader = Shader.Find("Lightweight Render Pipeline/Lit"); } } if (shaderType > 1) { if (isAlembic) { mat.shader = Shader.Find("Alembic/Standard"); if (texPack > 0) { mat.shader = Shader.Find("Alembic/Standard (Specular setup)"); } } else { mat.shader = Shader.Find("Standard"); if (texPack > 0) { mat.shader = Shader.Find("Standard (Specular setup)"); } } } } return(mat); } catch (Exception ex) { Debug.Log("Exception: " + ex.ToString()); MegascansUtilities.HideProgressBar(); return(null); } }
static void ImportMesh(string sourcePath, string destPath) { MegascansUtilities.UpdateProgressBar(1.0f, "Importing Megascans Asset", "Importing Mesh..."); MegascansUtilities.CopyFileToProject(sourcePath, destPath); }