- Home /
How to reexport fbx with meshes modified
Hi, guys, I am just trying to figure out How to reexport FBX with meshes modified on the Unity. I got some problem related normal coordinates and I modified them in unity, and then tried to export FBX ( using "ModelExporter.ExportObject" ) that have meshes modified, but it's not working. is there someone to know how to do it?
here's my code
GameObject gObj = (GameObject)Selection.activeObject;
List<Transform> children = new List<Transform>(gObj.transform.GetComponentsInChildren<Transform>());
bool isUpdated = false;
foreach( Transform tran in children)
{
SkinnedMeshRenderer sm = tran.GetComponent<SkinnedMeshRenderer>();
MeshFilter mf = tran.GetComponent<MeshFilter>();
if (!sm.Equals(null))
{
if (!sm.sharedMesh.Equals(null))
{
sm.sharedMesh = getOutLineNormal(sm.sharedMesh);
isUpdated = true;
}
}
else if(!mf.Equals(null))
{
if (!mf.sharedMesh.Equals(null))
{
mf.sharedMesh = getOutLineNormal(mf.sharedMesh);
isUpdated = true;
}
}
}
if(isUpdated)
{
string filelPath = AssetDatabase.GetAssetPath(gObj);
filelPath = string.Format("{0}\\{1}_1{2}", Path.GetDirectoryName(filelPath), Path.GetFileNameWithoutExtension(filelPath), Path.GetExtension(filelPath));
ModelExporter.ExportObject(filelPath, Selection.activeObject);
}
Comment