Unity 一键修改项目中所有模型动画压缩模式

        var assets = AssetDatabase.FindAssets("t:GameObject");
        
        AssetDatabase.StartAssetEditing();

        foreach (var guid in assets)
        {
            var assetPath = AssetDatabase.GUIDToAssetPath(guid);
            var modelImporter = AssetImporter.GetAtPath(assetPath) as ModelImporter;
            if (modelImporter == null)
                continue;

            if (modelImporter.importAnimation && modelImporter.animationCompression != ModelImporterAnimationCompression.Optimal)
            {
                modelImporter.animationCompression = ModelImporterAnimationCompression.Optimal;

                modelImporter.SaveAndReimport();
            }
        }

        AssetDatabase.StopAssetEditing();

        AssetDatabase.Refresh();

你可能感兴趣的:(Unity 一键修改项目中所有模型动画压缩模式)