AssetPostprocessor.OnPreprocessModel 在导入模型之前

function OnPreprocessModel () : void

Description描述

Add this function in a subclass to get a notification just before a model (.fbx, .mb file etc.) is being imported.

在子类中加入这个函数,以便在模型载入之前获得一个通知。

This lets you control the import settings trough code.

它让你控制导入选项

class MyMeshPostprocessor extends AssetPostprocessor {
   function OnPreprocessModel () {
		// Disable generation of materials if the file contains
		// the @ sign marking it as an animation.
		// 如果文件包含@符号,禁用generateMaterials
		if (assetPath.Contains("@")) {
			var modelImporter : ModelImporter = assetImporter;
			modelImporter.generateMaterials = 0;
		}
	}
}
最后修改:2011年1月8日 Saturday 22:34

本脚本参考基于Unity 3.4.1f5

英文部分版权属©Unity公司所有,中文部分© Unity圣典 版权所有,未经许可,严禁转载 。