描述

将此函数添加到一个子类中,以在导入模型(.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; } } }