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);
    }
  
 }
}

相关文章:

  • 2022-12-23
  • 2021-09-15
  • 2022-12-23
  • 2021-10-27
  • 2021-06-30
  • 2021-12-29
  • 2022-12-23
  • 2021-12-25
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-08-19
  • 2021-10-30
  • 2022-02-08
  • 2022-12-23
  • 2021-07-31
相关资源
相似解决方案