我可以从外部网址加载图片并将它们保存到我的Unity项目文件夹中,当我在我的电脑上运行它(统一播放器场景)它完美地工作时我可以将位于我项目中的图像加载到纹理表中并显示它但是在Android设备上运行时它无法正常工作。它不会将图像加载到纹理中
DirectoryInfo info = new DirectoryInfo(@"Assets\Photos\");
int nbImage;
nbImage = info.GetFiles("*.jpg").Length;
Debug.Log(nbImage);
Textures = new Texture2D[nbImage];
for (int i = 0; i < nbImage; i++)
{
string e = Application.streamingAssetsPath + "/" + i + ".jpg";
byte[] bytes;
bytes = System.IO.File.ReadAllBytes(e);
load_s01_texture = new Texture2D(1, 1);
load_s01_texture.LoadImage(bytes);
Textures[i] = load_s01_texture as Texture2D;
}
上的显示效果