如图,在编辑器绑定类型把cc.Node的数组换为{ a: number, b: string}的数组数据应该怎么实现啊?求助!!!
把数据对象写成自定义类,使用@ccclass装饰器
import { _decorator, Component, Node } from ‘cc’;
const { ccclass, property } = _decorator;
@ccclass(‘test’)
class test {
@property()
num: number = 0;
@property()
str: string = ‘’;
}
@ccclass(‘Test’)
export class Test extends Component {
@property({ type: [test] })
proname: test[] = [];
}
感谢大佬,终于明白了。
感谢大佬!
为啥要绑对象
不绑啥都能填,帮了无脑填