【发布时间】:2020-04-10 10:09:46
【问题描述】:
对不起,我对 unity 和 c# 很陌生。
我正在尝试读取图像并将其作为纹理应用。
当我在我的计算机上尝试使用图像时,该代码有效,但是,当我在我的 android 设备(手机和 AR 眼镜)上尝试时,我无法正确指定文件路径。如何正确指定 android 设备的文件路径,或者有什么方法可以获取这些文件路径?
非常感谢您提前提供的任何帮助! :)
void Start()
{
thisTexture = new Texture2D(100, 100);
//string path = "C:/Users/kenny/Desktop/5th March/im.png"; //this works
string path = "file:///storage/emulated/0/im2.png"; // this doesnt work
bytes = File.ReadAllBytes(path);
thisTexture.LoadImage(bytes);
GetComponent<Renderer>().material.mainTexture = thisTexture;
}
【问题讨论】:
标签: c# unity3d textures vuforia