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;
}


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM