Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/315.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Unity从Android中的资源加载TextAsset失败_C#_Android_Unity3d - Fatal编程技术网

C# Unity从Android中的资源加载TextAsset失败

C# Unity从Android中的资源加载TextAsset失败,c#,android,unity3d,C#,Android,Unity3d,我正在用Unity 4.3.4开发简单的游戏。 我的游戏应用程序需要在运行时加载JSON文本文件。 所以我过去喜欢以下内容 TextAsset asset = Resources.Load ( "stages" ) as TextAsset; string datafileContent = asset.text; doSomethingWithTextFile ( dataFileContent ); 我把json文本文件放在 \Assets\Resources\stages.json

我正在用Unity 4.3.4开发简单的游戏。 我的游戏应用程序需要在运行时加载JSON文本文件。 所以我过去喜欢以下内容

TextAsset asset = Resources.Load ( "stages" ) as TextAsset;
string datafileContent = asset.text; 
doSomethingWithTextFile ( dataFileContent );
我把json文本文件放在

\Assets\Resources\stages.json 
它只是工作得很好。。。仅在统一IDE中。 在Android中,它无法加载测试json文件

我怎样才能做到这一点? 请帮忙


感谢阅读。

根据unity文档,仅需.txt文件。因此,我建议您将格式转换为.txt并尝试一下。这应该行得通。虽然我没有尝试过Json,但据我所知,它可以在XML上工作。在这种情况下也应该有效