OnPostprocessModel not being applied to fbx imports

Hi there,
I made this script to change a few settings to animation fox’s that are imported into the project -

public class FBX_ImportHelper_CharacterAnimation : AssetPostprocessor
{
    void OnPostprocessModel(GameObject g)
    {
        if (g.name.Contains("@"))
        {
            ModelImporter modelImporter = assetImporter as ModelImporter;
            modelImporter.useFileScale = false;
        }
    }
}

It seems to check the right boxes but the settings aren’t applied. I have to jog it into action by changing any other setting and re-applying the changes.

Does anyone know why that’s not working? It would save so many accidental issues for me if I could get it to work.

Thanks!
Pete

I just went and looked at the AssetPostprocessor docs. There’s some other callbacks you can do for models importer… they’re a bit fiddly because there are stages to importing a model, and they let you hook them all. Perhaps there’s something critical in the later ones?

1 Like

Hey thanks Kurt, I just found something!
Feels a little hacky but if I put - modelImporter.SaveAndReimport(); at the end of the script it seems to work :eyes:

Who could have known!! :slight_smile:

Very cool. I used these importers a while ago and recalled it was … detail sensitive.

1 Like