想做个快捷生成脚本的creator插件,但缺少相关文档

2.3后好像只能在 场景脚本里使用


我点了这个按钮之后控制台上有输出 uuid

这api才有限制 cc.engine.getInstanceById(selection);

场景脚本相关文档:https://docs.cocos.com/creator/manual/zh/extension/scene-script.html?h=scene-s

谢谢,我好像找到了
Editor.Scene.callSceneScript(‘hello-world’, ‘get-selection’, function (err, length) {
console.log( get-canvas-children callback : length - ${length} );
});
从这里可以调用 scene-walk.js 的方法,然后我刚才的所有逻辑都挪到’get-selection’里面就可以了,多谢

如何调用 复制文本到wind剪切板的api啊?

https://segmentfault.com/a/1190000011511014 可以看看这个

1赞

请问如何获取节点下挂的脚本(比如main.ts),并修改脚本内容。就是想获取这个脚本的路径,然后修改脚本。
目前在"scene-script"下操作:
let CurNodeThree = Editor.Selection.curSelection(‘node’);
let node = cc.engine.getInstanceById(CurNodeThree[0])
遍历node._components 得到main.ts组件,然后就不懂怎么获取它的url??

我也卡在这,请问大佬解决了吗?

__scriptUuid,好像是这个

请问一下怎么把这个新创建的new-script.js用插件代码挂到
Editor.Selection.curSelection(‘node’)[0];选中的节点下呢
使用Editor.Ipc.sendToPanel(‘scene’, ‘scene:add-component’, node_uuid, ‘NewScript’);
会提示Failed to get component NewScript