I try to create a script and prefab from my custom extension and attach that script to created prefab but it keep saying that my create class is not child class of Component
const scriptResult = await Editor.Message.request(
"asset-db",
"create-asset",
"db://assets/" + name + ".ts",
"import { _decorator, Component, Node } from 'cc';\nconst { ccclass, property } = _decorator;\n\n@ccclass('" +
name +
"')\nexport class " +
name +
" extends Component {\n start() {\n\n }\n\n update(deltaTime: number) {\n \n }\n}\n\n",
{}
);
Here is how i create prefab
const prefab = await Editor.Message.request(
"asset-db",
"create-asset",
"db://assets/" + name + ".prefab",
'[\r\n {\r\n "__type__": "cc.Prefab",\r\n "_name": "",\r\n "_objFlags": 0,\r\n "_native": "",\r\n "data": {\r\n "__id__": 1\r\n },\r\n "optimizationPolicy": 0,\r\n "asyncLoadAssets": false\r\n },\r\n {\r\n "__type__": "cc.Node",\r\n "_name": "Node",\r\n "_objFlags": 0,\r\n "_parent": null,\r\n "_children": [],\r\n "_active": true,\r\n "_components": [],\r\n "_prefab": {\r\n "__id__": 2\r\n },\r\n "_lpos": {\r\n "__type__": "cc.Vec3",\r\n "x": 0,\r\n "y": 0,\r\n "z": 0\r\n },\r\n "_lrot": {\r\n "__type__": "cc.Quat",\r\n "x": 0,\r\n "y": 0,\r\n "z": 0,\r\n "w": 1\r\n },\r\n "_lscale": {\r\n "__type__": "cc.Vec3",\r\n "x": 1,\r\n "y": 1,\r\n "z": 1\r\n },\r\n "_layer": 1073741824,\r\n "_euler": {\r\n "__type__": "cc.Vec3",\r\n "x": 0,\r\n "y": 0,\r\n "z": 0\r\n },\r\n "_id": ""\r\n },\r\n {\r\n "__type__": "cc.PrefabInfo",\r\n "root": {\r\n "__id__": 1\r\n },\r\n "asset": {\r\n "__id__": 0\r\n },\r\n "fileId": "c46/YsCPVOJYA4mWEpNYRx"\r\n }\r\n]',
{}
);
[Scene] ctor with name aa30f0c6-348d-4bbd-bcf7-fcbd80c78329 is not child class of Component```