Static models with an assigned batch group disappear when reloading the scene
Description
Static models in a scene that have a Batch Group assigned disappear when the same scene is destroyed and reloaded, regardless of whether or not the batcher has ran.
Upon first load, you'll see a couple of plane entities laid out. The outer circle of planes have no batch group assigned, whereas anything inside the circle have a single batch group assigned with its layer set to World. Once you reload the scene by pressing 'L', you'll notice that all the planes that had a batch group assigned disappear from the scene, and the ones without a batch group remain in place as expected.
Tested on Windows 10 (2004 - 19041.985) using Google Chrome v91.0.4472.77, and Firefox v89.0, PlayCanvas v1.42.0
Steps to Reproduce
- Create a few entities around the scene and set them to be Static
- Create a new Batch Group and give it the World layer
- Assign the new batch group to the entities
- Load the game, see that all entities load fine
- Use
SceneRegistry.loadSceneHierarchyto reload the scene and destroy the old hierarchy - Observe that the entities with a batch group have disappeared.
Screenshots
Screenshot 1 - Before reloading the scene

Screenshot 2 - After reloading the scene

I tried looking into this, but have not found an issue .. it would need more time and deeper investigation, perhaps another time.
As a workaround (not the same behaviour, I understand) would be to remove the previous scene before new one gets loaded.
SceneSwitchButton.prototype.loadScene = function() {
var oldHierarchy = this.app.root.findByName('MyScene');
var scene = this.app.scenes.find("GameScene");
oldHierarchy.destroy();
this.app.scenes.loadSceneHierarchy(scene.url, function (err, parent) {
if (!err) {
} else {
console.error(err);
}
});
};
A smaller repo of this project as another client ran into this issue: https://playcanvas.com/project/971118/overview/adding-batch-group-entity-at-rt