获取GUITexture
GameObject _obj = GameObject.Find("Tex1");
GUITexture _tex = _obj.GetComponent<GUITexture>();
加载图片字节流
//读取文件到byte数组
byte[] bytes = System.IO.File.ReadAllBytes(@"Assets\MapTex_1\gs_0_74_8.jpg";
Texture2D _tex2D = new Texture2D(256,256);
_tex2D.LoadImage(bytes);
替换texture
_tex.texture = _tex2D;
时间: 2024-10-09 19:30:12