【发布时间】:2015-03-07 13:25:25
【问题描述】:
我尝试访问由 unity 创建的 Android 应用程序上的一些 XML 文件。我将它们放在我的 StreamingAssets 文件夹中,并通过 Application.streamingAssetsPath 恢复它们。
这是我获取路径的代码:
int index=0;
index=m_RuleBaseFilePath.LastIndexOf("/");
string path= m_RuleBaseFilePath.Substring(index,m_RuleBaseFilePath.Length-index);
TextAsset textAsset = (TextAsset)Resources.Load(path, typeof(TextAsset));
string realpath=Application.streamingAssetsPath+path;
当我尝试构建和运行时,此代码适用于编辑器和 Windows,但不适用于 Android。我问自己是否通过这种方法获得了良好的路径。 有什么调试方法可以检查吗?
感谢您的帮助。
【问题讨论】:
-
你想访问什么?您是否将 XML 文件保存在 Layout 文件夹中?
-
我尝试使用以下路径访问我的 XML 文件:string realpath=Application.streamingAssetsPath+path; Unity 将 Xml 文件保存在 assets 文件夹中:test.apk\assets
-
检查这可能对你有帮助。 answers.unity3d.com/questions/516735/…
标签: c# android xml path unity3d