CocosCreator 动态设置属性在Properties面板显示/隐藏
Test.ts
const{ccclass,property}=cc._decorator;
var KEY=cc.Enum({});
Object.assign(KEY,cc.macro.KEY);
@ccclass
export default class Test extends cc.Component{
@property({type:KEY,visible:true})
private _leftKey:cc.macro.KEY=cc.macro.KEY.a;
@property({visible:true,})
private _enableSecondKey:boolean=false;
@property({type:KEY, visible(){return this._enableSecondKey;} })
private _leftKey2:cc.macro.KEY=cc.macro.KEY.left;
}