Problem with visible attribute for array list or multi same components

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]

        },
    },
});

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

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

1 Like

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

1 Like

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?

Because I did not find a solution to this problem, I had to disregard the use of the array.

But for my bad luck, the use of two components has the same problem.

Capture

if ‘Must Show’ is false, it should not show ‘See Me’

Thanks for the reply.

@jare I’m still looking for a solution

We will fix this bug in 1.10. Please split into two array for now.

1 Like

Thanks for reply.