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;
	}
}
Page last updated: 2011-1-8