Skip to content

Add BatchManager.getGroupById method#8399

Merged
mvaligursky merged 1 commit into
mainfrom
mv-batch-group-by-id
Jan 22, 2026
Merged

Add BatchManager.getGroupById method#8399
mvaligursky merged 1 commit into
mainfrom
mv-batch-group-by-id

Conversation

@mvaligursky

@mvaligursky mvaligursky commented Jan 22, 2026

Copy link
Copy Markdown
Contributor

Adds a new public method getGroupById(id) to BatchManager that retrieves a BatchGroup by its numeric ID.

Background

Components such as render, model, element, and sprite store a batchGroupId property, but there was no public API to retrieve the corresponding BatchGroup object from the manager. Users had to either:

  • Use getGroupByName() (requires knowing the name)
  • Access the private _batchGroups property directly

Changes

  • Added getGroupById(id) method that returns the BatchGroup with the specified ID, or null if not found
  • Mirrors the existing getGroupByName() API

Public API Additions

/**
 * Retrieves a BatchGroup object with a corresponding id, if it exists, or null otherwise.
 * @param {number} id - The batch group id.
 * @returns {BatchGroup|null}
 */
batchManager.getGroupById(id)

Usage Example

const group = app.batcher.getGroupById(entity.render.batchGroupId);
if (group) {
    console.log(`Group: ${group.name}, dynamic: ${group.dynamic}`);
}

Fixes #8388

@mvaligursky mvaligursky merged commit d72eed3 into main Jan 22, 2026
7 checks passed
@mvaligursky mvaligursky deleted the mv-batch-group-by-id branch January 22, 2026 16:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add BatchManager method getGroupById

2 participants