Texture img = (Texture)Resources.Load("LedPicture"); GameObject.Find("Led").renderer.material.mainTexture = img;

 

稍微解释一下:

1、"LedPiture"是一张图片(LedPicture.png)

2、这两句话是将Led这个Object的材质换成LedPicture.png的样子


注:LedPicture.png要放在工程文件的Assets\Asset\Resources这个目录下,如果没有Resources目录则先建一个Resources文件夹,然后把图片放进去就可以了!

 

原文地址:http://blog.csdn.net/exlsunshine/article/details/22210177

相关文章:

  • 2022-12-23
  • 2021-12-12
  • 2022-01-13
  • 2021-09-03
  • 2021-11-09
  • 2022-03-13
  • 2021-12-12
  • 2021-09-24
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-28
  • 2021-12-07
相关资源
相似解决方案