Cocos Creator Editor 第一个编辑器扩展(扩展菜单)
项目路径\packages\helloEditor\package.json
{
"name": "hello-editor",
"version": "0.0.1",
"description": "一份简单的扩展包",
"author": "Cocos Creator",
"main": "main.js",
"main-menu": {
"Tools/Test": {
"message": "hello-editor:say-hello"
}
}
}
name: 扩展包名,只能小写
Tools/Test: 自定的菜单
message: 扩展包名:函数名
详细说明:https://docs.cocos.com/creator/manual/zh/extension/your-first-extension.html
package.js更多字段说明:https://docs.cocos.com/creator/manual/zh/extension/reference/package-json-reference.html
项目路径\packages\helloEditor\main.js
'use strict';
module.exports = {
load () {
// 当 package 被正确加载的时候执行
},
unload () {
// 当 package 被正确卸载的时候执行
},
messages: {
'say-hello' () {
Editor.log('Hello World!');
}
},
};