var bumpMap:Object[];
function Start()
{
var namett:String="4";//贴图名,以后直接读取文本
bumpMap= Resources.LoadAll("Textrue", Texture2D);//载入resources所有的贴图为数组
for(var tx:Texture2D in bumpMap)
{
var shade01:Shader=Shader.Find("Bumped Diffuse");
gameObject.renderer.material.shader=shade01;
print(tx.name);
if(tx.name == namett)
{
print(tx.name);
gameObject.renderer.sharedMaterial .SetTexture("_BumpMap", tx); //指定贴图
gameObject.renderer.sharedMaterial .SetTexture("_MainTex", tx);
}
}
}