Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Panel.instanceManager.addInstance/removeInstance very slow

ajur
Level 2
Level 2

Hello,

 

I have following setup:

Bildschirmfoto 2021-11-09 um 15.17.48.png

The first input is a dropdown with entries 1 to 10. The following three inputs are placed into a panel named "panel_child". If the user selects the count of his children, the panel should be displayed in the count, he selected.

I wrote a rule for the dropdown if the value is changed with following code:

var childCount = this.value;
var panelChildCount = panel_child.instanceManager.instanceCount;
if (childCount > panelChildCount) {
var instancesToAdd = childCount - panelChildCount;
for (var i=0; i<instancesToAdd; i++) {
panel_child.instanceManager.addInstance();
}
} else if (childCount < panelChildCount) {
var instancesToRemove = panelChildCount - childCount;
for (var i=0; i<instancesToRemove; i++) {
panel_child.instanceManager.removeInstance(panel_child.instanceIndex);
}
}

If only one or two panels are to be added or deleted, it runs smoothly. However, when I need to add or delete many, it becomes very very slow.

Did I do anything wrong in my code?

 

Thanks for helping me!

Andrea

1 Accepted Solution
Mayank_Tiwari
Correct answer by
Employee
Employee

@ajur ,

I am also able to reproduce this issue on 6.5.10, when more than 3 instances are added or removed. Seems like a bug. Please log a support case so that it can be fixed. Thanks!

View solution in original post

2 Replies
Mayank_Tiwari
Correct answer by
Employee
Employee

@ajur ,

I am also able to reproduce this issue on 6.5.10, when more than 3 instances are added or removed. Seems like a bug. Please log a support case so that it can be fixed. Thanks!

View solution in original post

ajur
Level 2
Level 2

Uhm, that's pity. I try to find a short-term solution myself for so long.