Hi there! Earlier than creator 3.0 we have been utilizing this tutorial to optimise all scroll views in our tasks:
In model 3.5.0 when i set 0 opacity to a node draw calls don’t drop down.
this.node.getComponent(UIOpacity)!.opacity = 0
This fashion will not be good:
this.node.lively = false
as a result of it freezes a sport
Is there a brand new good option to optimise a scrollview?
Turning off the node is freezing the sport? i dont’ perceive that.
You could possibly attempt to disable the scrollview part.
node.getComponent(ScrollView).enabled = false
im’ extra confused now. So based mostly on the documentation opacity =0 ought to work however you aren’t seeing the draw calls go down. Now you tried node.lively=false however that could be a enormous efficiency hit? If the node has a sprite part related, you may disable that so the rendering stops// another take a look at similar to node.lively = false.
I set enabled part to false to optimize.
Instance:
replace (dt) {
var viewRect = cc.rect(- this.view.width / 2, - this.content material.y - this.view.top, this.view.width, this.view.top);
for (let i = 0; i < this.content material.kids.size; i++) {
const node = this.content material.kids[i];
if (viewRect.intersects(node.getBoundingBox())) {
node.getComponent(cc.Sprite).enabled = true;
node.getChildByName('textual content').getComponent(cc.Label).enabled = true;
}
else {
node.getComponent(cc.Sprite).enabled = false;
node.getChildByName('textual content').getComponent(cc.Label).enabled = false;
}
}
}
I’ve a ticket on github relating to CC3 and opacity = 0 that I actually preferred in CC2 the place it didn’t render and trigger drawcalls.