UnityAndroid 获取根目录文件
1. 在Unity打包时获取SD权限
2. Android根目录为 "/storage/emulated/0";
代码:
if (Directory.Exists("/storage/emulated/0/xxx")) { StartCoroutine(PostRequest("/xxx/TestLoad.txt", "message")); if (File.Exists("/storage/emulated/0/xxx/TestLoad.txt")) { try { text.text = File.ReadAllText("/storage/emulated/0/xxx/TestLoad.txt"); } catch (System.Exception e) { text.text = e.Message; throw; } } }