Material.GetTexture 获取纹理

function GetTexture (propertyName : string) : Texture


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:

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

"_BumpMap" is the normal map.

"_Cube" is the reflection cubemap.

参考: mainTexture 属性, SetTexture .

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