使用该环境变量去创建文件失败,提示:The file did not exist and failed to be created, msg=path must be a string。
输出打印的地址是:文件路径是:http://usr/player_data.txt
this._filePath = string.Format("{0}/{1}.txt", WX.env.USER_DATA_PATH, "player_data");
Error($"文件路径是:{this._filePath}");
if (_fs.AccessSync(this._filePath) != "ok")
{
var result = _fs.WriteFileSync(this._filePath, defaultBytes);
if (result != "ok")
{
Error($"The file did not exist and failed to be created, msg={result}");
}
}
备注一下:unity转微信小游戏,用的是https://github.com/wechat-miniprogram/minigame-unity-webgl-transform框架。代码是在C#中写的,看桥接代码,应该是写在SDK-Call-JS-Old.jslib文件中的,但是我加了输出,不知道为啥没执行到。