Problem with visible attribute for array list

Problem with visible attribute for array list
0.0 0

#1

Hi everybody,

My code has 2 properties that define the first one to show or hide the latter.

1

2

let enEffectTargetMode = cc.Enum({
    Me: 0,
    Other: 1,
});

let clsEffectsTest = cc.Class({
    name: 'clsEffectsTest',
    properties: {

        effectTargetMode: {
            default: enEffectTargetMode.Me,
            type: enEffectTargetMode
        },

        effectTaget: {
            type: cc.Node,
            default: null,
            visible: function () {
                if (this.effectTargetMode == enEffectTargetMode.Me)
                    return false;
                else
                    return true;
            }
        }
    },

});


cc.Class({
    extends: cc.Component,

    properties: {

        effects: {
            default: () => {
                return new clsEffectsTest();
            },
            type: clsEffectsTest
        },
    },
});

but when use array for my class.
By changing the class property that is not in the last array. nothing happens.
But by changing the properties of the last class of the array, all classes change

3

4

cc.Class({
    extends: cc.Component,

    properties: {

        effects: {
            default: () => {
                return [new clsEffectsTest()];
            },
            type: [clsEffectsTest]

        },
    },
});

#2

Is there no one who knows the solution of this problem?


#3

I’ve also noticed this issue. I have no solution though :frowning:


#4

Friends, finding the solution to this problem is very important. My component has a lot of properties, which, if it is displayed at the same time, creates confusion. And that I have to use an array of classes.

Is there any way in the class ctor to get the index of the array in which this class is inside?

please help


#5

I’m really disappointed with the cocos development team. This problem is vital to me. Does the development team not found the solution to this problem?