When I edit the FBX in the Unity editor, I want the actual file to be replaced as well.

hello

I use the unity editor
When I edit the FBX in the Unity editor, I want the actual file to be replaced as well.

After replacing the mesh of the FBX file, I saved the file in the mesh of the FBX.

In Unity, it appears as a replaced mesh.

but the actual file didn’t change

can i solve this

(I am using the asset’s code modified to save the mesh with lower quality.
Mantis LOD Editor - Professional Edition | Modeling | Unity Asset Store)

static void MakeMini(GameObject obj)
    {
        //OnPostprocessModel(GameObject model) Call this method

        //Get GameObject
        MeshFilter[] meshArr = obj.GetComponentsInChildren<MeshFilter>();
        MantisLODEditor.Mantis_Mesh[] mantisArr = new MantisLODEditor.Mantis_Mesh[meshArr.Length];

        float quality = 10.0f;// 0 ~100
        if (meshArr.Length > 0)
        {
            for (int i = 0; i < mantisArr.Length; i++)
            {
                mantisArr[i] = new MantisLODEditor.Mantis_Mesh();
                mantisArr[i].mesh = meshArr[i].sharedMesh;
            }
            float oldFaceNumber = MantisLODEditor.MantisLODEditorUtility.PrepareSimplify(mantisArr);

            //Make Low Quality
            bool protect_boundary = true;
            bool protect_detail = false;
            bool protect_symmetry = false;
            bool protect_normal = false;
            bool protect_shape = true;
            bool use_detail_map = false;
            int detail_boost = 10;
            MantisLODEditor.MantisLODEditorUtility.Simplify(mantisArr, protect_boundary, protect_detail, protect_symmetry, protect_normal, protect_shape, use_detail_map, detail_boost);
            int faceNumber = MantisLODEditor.MantisLODEditorUtility.SetQuality(mantisArr, quality);

            //Change Mesh
            for (int i = 0; i < meshArr.Length; i++)
            {
                meshArr[i].sharedMesh = mantisArr[i].mesh;
            }

        }
    }

Unity can’t / won’t write FBX files.

You can write regular old Mesh assets yourself if you like.

You can use ProBuilder from Unity to import your FBX and edit and save it. Look up the “Probuilderize” feature.

Are you actually saving these changes and refreshing the asset database at the same time? If you edit anything via code you need to inform Unity that assets have changed.

I added AssetDatabase.SaveAssets(); to the last line of the function

In Unity, it looks like the mesh of FBX has changed,

It hasn’t really changed.

I previously imported the FBXExport package into unity
And I exported the FBX file using FBXExport.
[order]

  1. Import the FBXExport package
  2. Drag & drop FBX file to Hierarchy
  3. GameObject - (right click) - FBXExport

However, the capacity has increased by almost 15 times.

My guess is that even using ProBuilder, the file size of FBX will increase.
(This is my guess, I haven’t tried it yet.)

It didn’t work because I wanted to reduce the modeling capacity of the FBX.

I think I did something meaningless

I wanted to reduce the size of the FBX because I had to reduce the size of the AssetBundle.

I changed the Mesh Compression of the Model to High.
And changed the Compression of AssetBundle to LZMA

And when I made an AssetBundle, the capacity decreased a lot.
Thanks for answering my small question