In editor, how to show/hide property in component according to value set in another property?


For example, in the Sprite component, if you set the Type property to FILLED, properties related to filled type sprites (Fill Type, Fill Center, Fill Start, Fill Range) are shown. When Type is set to any other type, the properties are hidden. How can I create this effect in my custom components? I’d like to make components less cluttered for the designer.



hi ,
you can do something like this.

    extends: cc.Component,

    properties: {

        showNextProp : {
            default : true,

        textLabel : {
            default: " Label ",
            visible : function () {
                return this.showNextProp;


    onLoad () {},


you can get the idea about other kind of situations.


Right, the visible property. Of course. Thanks!