不同的图片会在相同的StaticVBAccessor请求chunk,大量创建图片后超过了StaticVBAccessor的临界值,导致后面的sprite的renderData使用的chunk的bufferid不同,修改层级后不同buffid的图片穿插,导致相同图片无法合批, 请问有没有好的解决办法 。
可不可以为Sprite指定单独的 chunk, 或者合批忽略buffid
测试代码如下
import { _decorator, Component, instantiate, math, Node } from 'cc';
const { ccclass, property } = _decorator;
@ccclass('NewComponent')
export class NewComponent extends Component {
@property(Node) node1: Node
@property(Node) node2: Node
@property(Node) parnet1: Node
@property(Node) parnet2: Node
@property count = 1000
start() {
for (let i = 0; i < this.count; i++) {
const el1 = instantiate(this.node1)
el1.parent = this.parnet1
const el2 = instantiate(this.node2)
el2.parent = this.parnet2
}
for (let i = 0; i < this.count; i++) {
const child = this.parnet1.children[i]
child.setSiblingIndex(math.randomRangeInt(i, this.count ))
}
}
}
