Unity Streaming-assets内容未在Oculus Quest/Go中读取



我正在做一个涉及从StreamingAssets读取内容的项目。

它在unity引擎和Oculus Rift中完美运行,但是当将apk导出到Oculus Quest/Go时,不会发生流式传输(测验不会加载(。

有没有人遇到过通过Quest/Go应用程序访问StreamingAssets的问题? 你解决了吗?

我测试过的东西: 阅读任务:外部 内部力 我通过Android Studio(空(检查了Logcat。

主要功能是:

private string getPath()
{
#if UNITY_EDITOR
return Application.streamingAssetsPath;
#elif UNITY_ANDROID
return Application.persistentDataPath;
#elif UNITY_STANDALONE_WIN
return Application.streamingAssetsPath;
#else  
return "";
#endif
}
private string[] loadExternal_Question(int qIndex)
{
Debug.Log("External File: " + getPath() + "/Quiz/Q" + qIndex + ".txt");
string[] q_Data = File.ReadAllLines(getPath() + "/Quiz/Q" + qIndex + ".txt");
QuestionTitle_LB.text = q_Data[0].Replace("//n", "n");
Answer_1.text = q_Data[1].Replace("//n", "n");
Answer_2.text = q_Data[2].Replace("//n", "n");
Answer_3.text = q_Data[3].Replace("//n", "n");
Answer_4.text = q_Data[4].Replace("//n", "n");
CurrentQ = int.Parse(q_Data[5]);
FeedBack_LB.text = q_Data[6].Replace("//n", "n");
return q_Data;
}

我注意到该问题可能是由信息在流媒体资产中引起的。 但是如何在 Unity 中定义持久数据路径,以便它可以从那里读取? 或者,适用于Quest/Go的Android应用程序可以从StreamingAssets读取吗?

StreaminAssets 的内容在 APK 中压缩。您如何访问它? 如果要打开文本文件,可以执行以下操作:

string json;
#if UNITY_EDITOR || !UNITY_ANDROID
json = File.ReadAllText(StreamingJsonPath);
#else
// streamingAssets are compressed in android (not readable with File).
WWW reader = new WWW (StreamingJsonPath);
while (!reader.isDone) {}
json = reader.text;
#endif

最新更新