cocos creator3d开发插件
官方
给的答案是这样子的,发现根据里面设置的内容,并不能完成。
cocos creator2d
https://docs.cocos.com/creator/manual/zh/extension/your-first-extension.html
cocos creator3d
https://docs.cocos.com/creator3d/manual/zh/editor/extension/first.html
{
"name": "hello-world",
"version": "1.0.0",
"main": "./browser.js",
"description": "一份简单的扩展",
"contributions": {
"menu": [{
"path": "Develop",
"label": "test",
"message": "log"
}],
"messages": {
"log": {
"methods": ["log"]
}
}
}
}
这是当前的样子。无法运行。
解决方案
从编辑器里面,创建插件,生成package,然后保存。
{
"name": "hello-world",
"version": "1.0.0",
"package_version":2,
"main": "browser.js",
"description": "一份简单的扩展",
"author": "dema",
"contributions": {
"menu": [{
"path": "Develop",
"label": "hello_test",
"message": "log"
}],
"messages": {
"log": {
"methods": ["log"]
}
}
}
}
}
'use strict';
// 扩展内定义的方法
exports.methods = {
log() {
console.log('Hello dodod');
}
};
exports.load = function () { };
exports.unload = function () { };
注意
main ,不能用 main.js
package_version ,必须填写