一、添加权限
权限添加 :Player settings -- Other settings -- write permission的设置 Sdcard。这个是在Unity编辑器里打包的情况。
如果导出到studio 里面的话,可自行修改Manifest文件。
二、两种方式
IO方式 加载sdcard上的图片资源
加载的 /storage/emulated/0/ProjectName/image.jpg,
image = this.GetComponentInChildren();
Debug.Log("IO加载用时: image = this.GetComponent ========== " + image);
Debug.Log("IO加载: Application.dataPath " + Application.dataPath );
// Application.dataPath /data/app/com.putao.ptx.core-1/base.apk
Debug.Log("IO加载: Application.persistentDataPath " + Application.persistentDataPath);
// Application.persistentDataPath /storage/emulated/0/Android/data/com.putao.ptx.core/files
Debug.Log("IO加载:GameObject.Find" + GameObject.Find("Canvas/Avator").GetCo