【问题标题】:Why does the Android version contain robot artifacts?为什么安卓版本会包含机器人神器?
【发布时间】:2020-07-26 06:32:07
【问题描述】:

对于机器人模拟,我使用带有数据的 csv 文件。我读取数据如下:

string dbPath = ""; string realPath; // Android string oriPath = System.IO.Path.Combine(Application.streamingAssetsPath, "Data.csv");

         // Android only use WWW to read file
         WWW reader = new WWW(oriPath);
         while (!reader.isDone) { }
         realPath = Application.persistentDataPath + "/db";
         System.IO.File.WriteAllBytes(realPath, reader.bytes);
         dbPath = realPath;
         using (StreamReader sr = new StreamReader(dbPath))
         {...}

在 Unity 编辑器版本中,模拟按预期工作,但在 Android 上,机器人的手臂以一种奇怪的方式移动,正如您在视频中看到的那样。我比较了两个 db 文件(在 Windows 和 Android 路径上),内容是相同的。奇怪的动作可能是什么原因?

编辑https://streamable.com/7z4qob安卓https://streamable.com/rv4nm2

谢谢!

【问题讨论】:

    标签: android unity3d simulation robot artifacts


    【解决方案1】:

    要获取 StreamingAssets WWW,您需要添加前缀 jar:file:///

    要获取 Application.persistentDataPath,您需要添加前缀 file:///

    如果文件相同,那么问题不在 getFile 代码中,为什么要提供它?

    【讨论】:

    • 谢谢白边!我现在改了帖子。你有什么想法可能是工件的进一步来源?
    • 我不知道。您需要向机器人添加一些 Debug 输出以了解可能出了什么问题。
    猜你喜欢
    • 2012-02-22
    • 1970-01-01
    • 2012-03-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多