[Unity]FBX默认导入设置修改器

2020/03 30 21:03
using UnityEditor;
public class EditorFbxImportSetting : AssetPostprocessor 
{
    void OnPreprocessModel() 
    {
        ModelImporter importer = assetImporter as ModelImporter;
        if (importer == null)
        {
            return;
        }

        string name = importer.assetPath.ToLower();
        string extension = name.Substring(name.LastIndexOf(".")).ToLower();
        switch (extension) 
        {
        case ".3ds":
        case ".fbx":
        case ".blend":
            importer.importMaterials = false;
            importer.importCameras = false;
            importer.importLights = false;
            importer.generateSecondaryUV = false;
            importer.swapUVChannels = false;
            importer.optimizeMesh = true;
            break;

        default:
            break;
        }
    }
}

这样美术在导入FBX时,就不用一个个勾掉Material设置了