最近刚转cocos,自己尝试写一个插件在prefab编辑模式下,获取自己创建并绑定脚本,来一键修改脚本内容,目前我通过 let treeinfo = await Editor.Message.request(‘scene’, ‘query-node-tree’, uuid);可以拿到prefab的信息,然后解析信息,可是解析到components拿取 脚本路径出现问题,如图:
结果得到的值时null,我是通过
Editor.Message.request(‘asset-db’, ‘query-path’, element.value) 获取为空,是我用姿势不对还是用错了方法,请大家帮忙指点下
打印的这个value到底是什么东西?怎么通过它获取uuid?
let uuid = Editor.Utils.UUID.decompressUUID(element.value);
console.log("uuid--->", uuid);
let isuuid = Editor.Utils.UUID.isUUID(element.value);
console.log("isuuid--->", isuuid);
// let uuid="9e166342-4f9b-4661-b38c-53dc4c8c4019";
通过解压uuid 也不行 解出来的uuid对不上
求助求助
换 了一种思路 使用await Editor.Message.request(‘scene’, ‘query-components’);来获取所有组件 让后自己再解析下ok