如何使扩展添加自定义组件?

时间:2020-07-24 09:24:09

标签: typescript cocoscreator

我有一个TypeScript文件,该文件具有继承cc.Component的类。我想将其放入扩展包中,并在添加包后在编辑器中对其进行访问(可以选择将其添加到节点等)。我该怎么办?

1 个答案:

答案 0 :(得分:0)

将以下代码添加到package.json

"runtime-resource": {
    "path": "scripts",
    "name": "scripts"
}

然后将您的.ts文件放在程序包目录的scripts文件夹中。结果,事物应该或多或少看起来像这样:

enter image description here

来源:https://discuss.cocos2d-x.org/t/how-to-make-an-extension-add-a-custom-component/51004/6?u=quickz

相关问题