Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Manually created batches can't be destroyed using BatchManager #7297

Closed
OlegGedzjuns opened this issue Jan 20, 2025 · 2 comments · Fixed by #7340
Closed

Manually created batches can't be destroyed using BatchManager #7297

OlegGedzjuns opened this issue Jan 20, 2025 · 2 comments · Fixed by #7340
Assignees
Labels
area: graphics Graphics related issue docs Documentation related

Comments

@OlegGedzjuns
Copy link
Contributor

Description

It is possible to manually prepare and create batches using BatchManager prepare() and create() methods.
BatchManager also has destroyBatch() method, but calling it with a manually created batch causes a crash.

Link to example: https://playcanvas.com/project/1295595/overview/manual-batching-issue

Also according to destroy method implementation, batches from _batchList array are never removed.

destroyBatch(batch) {

@mvaligursky
Copy link
Contributor

you should call batch.destroy instead of private batcher.destroyBatch.
I just made it public.

        //this.app.batcher.destroyBatch(batch);
        batch.destroy(this.app.scene, [pc.LAYERID_WORLD]);

@mvaligursky mvaligursky self-assigned this Feb 10, 2025
@mvaligursky mvaligursky added docs Documentation related area: graphics Graphics related issue labels Feb 10, 2025
@OlegGedzjuns
Copy link
Contributor Author

Yes, it is possible to use batch.destroy() method. But destroyed batches are still in the _batchList array.
Example project was updated to use dynamic batches so now you can see the issue more clearly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: graphics Graphics related issue docs Documentation related
Projects
None yet
2 participants