import { _decorator, assetManager, Component, error, Node, path, Sprite, native, Vec3 } from ‘cc’;
const { fileUtils } = native;
const nodeInfo = this.getNodeInfo(this.node);
const content = JSON.stringify(nodeInfo, null, 4);
const assetsPath = Editor.Project.path + '/assets';
const filePath = path.join(assetsPath, 'node-info2.json');
fileUtils.writeStringToFile(filePath, content);
在windown本地开发环境运行的:然后一直报错:Cannot read property ‘writeStringToFile’ of undefined。
官方文档:
import { native } from “cc”;
const { fileUtils } = native; 也是这样导入的
有没有大佬遇到过这个问题
