static void GetMaterial(string modelPath, FBXModelPtr model, ref List <Material> materials) { if (model.GetMaterialCount() > 0) { for (int i = 0; i < model.GetMaterialCount(); ++i) { FBXMaterialPtr mat = model.GetMaterial(i); if (!mat.IsNull()) { Material material = new Material(Shader.Find("Standard")); material.name = mat.GetName(); if (mat.Exist("Diffuse")) { material.SetColor("_Color", FBXVector3ToUnityColor(mat.GetVector3("Diffuse"))); } if (mat.Exist("DiffuseColor")) { material.name = Path.GetFileNameWithoutExtension(mat.GetString("DiffuseColor")); material.mainTexture = TryLoadTexture(modelPath, Path.GetFileName(mat.GetString("DiffuseColor")), TextureFormat.RGBA32, true); } if (mat.Exist("NormalMap")) { material.SetTexture("_BumpMap", TryLoadTexture(modelPath, Path.GetFileName(mat.GetString("NormalMap")), TextureFormat.RGBA32, true)); } materials.Add(material); } } } }