Material.GetTexture 获取纹理

function GetTexture (propertyName : string) : Texture

Description描述

Get a named texture.

获得已命名纹理

Many shaders use more than one texture. Use GetTexture to get the propertyName texture.

许多着色器都使用超过一张纹理,使用GetTexture获得 propertyName的纹理。

Common texture names used by Unity's builtin shaders:
在unity着色器中使用的统一的纹理名称

"_MainTex" is the main diffuse texture. This can also be accessed via mainTexture property.
"_MainTex"是主要的漫反射纹理,也能通过 mainTexture 属性访问

"_BumpMap" is the normal map.
"_BumpMap"是法线贴图

"_Cube" is the reflection cubemap.
"_Cube"是反射cubemap.(立方体贴图)

参考: mainTexture 属性, SetTexture .

function Start () {
	var tex : Texture = renderer.material.GetTexture ("_BumpMap");
	if (tex)
		print ("My bumpmap is " + tex.name);
	else
		print ("I have no bumpmap!");
}
Page last updated: 2011-1-22