AssetPostprocessor.OnPreprocessTexture 在导入纹理之前

function OnPreprocessTexture () : void

Description描述

Add this function in a subclass to get a notification just before the texture importer is run.

在子类中重载这个函数以便在纹理导入器运行之前获取通知

This lets you setup default values for the import settings.

这允许你设置默认值到导入选项

class MyTexturePostprocessor extends AssetPostprocessor
{
function OnPreprocessTexture () {
	// Automatically convert any texture file with "_bumpmap"
	// in its file name into a normal map.
	//自动转换文件名带有_bumpmap的任意纹理文件为一个法线贴图
	if (assetPath.Contains("_bumpmap")) {
		var textureImporter : TextureImporter = assetImporter;
		textureImporter.convertToNormalmap = true;
	}
}
最后修改:2011年1月8日 Saturday 21:59

本脚本参考基于Unity 3.4.1f5

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