Problem with visible attribute for array list or multi same components

Problem with visible attribute for array list or multi same components
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?


#6

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’


#7

Thanks for the reply.


#8

@jare I’m still looking for a solution


#9

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


#10

Thanks for reply.