CocosCreator本身不支持二维数组在编辑器显示
但是思路拐个弯就可以轻松实现
import { _decorator, Component, Node, CCFloat, SpriteFrame, CCString } from 'cc';
const { ccclass, property } = _decorator;
@ccclass("Type")
export class Type {
@property({displayName: "班级"})
class: string = "";
@property({displayName: "姓名", type: CCString})
name: string[] = [];
@property({displayName: "年龄", type: CCFloat})
age: number[] = []
@property({displayName: "照片", type: SpriteFrame})
photo: SpriteFrame[] = [];
}
@ccclass('Test')
export class Test extends Component {
@property(Type)
person: Type[] = [];
}
数组里面套数组,快乐翻倍