how to override " scene.primitives.removeAll();"

i want to remove all primitives added to the scene except tiles

  var tileset = new Cesium.Cesium3DTileset({ url: Cesium.IonResource.fromAssetId(4693) });
viewer.scene.primitives.add(tileset);
  tileset.style = new Cesium.Cesium3DTileStyle({
        color: {
            conditions: [
                       
                ["true", "color('green')"]
            ]
        }
    });
  
how to make tileset override the reomoveAll(); i want to keep them all the time.

I would just write your own version of the removeAll function.

Here’s what it’s doing in the source. You can do the same loop but keep the ones you want (maybe mark them with tileset.keep = true or something).