将此函数添加到子类中,以便在导入模型(.fbx、.mb 文件等)之前收到通知。
这使您可以通过代码控制导入设置。
using UnityEngine; using UnityEditor;
// Disable import of materials if the file contains // the @ sign marking it as an animation. public class Example : AssetPostprocessor { void OnPreprocessModel() { if (assetPath.Contains("@")) { ModelImporter modelImporter = assetImporter as ModelImporter; modelImporter.materialImportMode = ModelImporterMaterialImportMode.None; } } }