EntityOverlayBatch:destroy
Client-Side Function
JavaScript Syntax
This method will destroy an entity overlay batch.
Return value
- void
Syntax
batch.destroy();
Example
//Enable entity overlay batch
mp.game.graphics.setEntityOverlayPassEnabled(true);
//Create new entity overlay batch
let batch = mp.game.graphics.createEntityOverlayBatch(overlayParams);
//Add a vehicle to overlay batch once the player enters in them.
mp.events.add('playerEnterVehicle', (vehicle) => {
batch.add(vehicle);
});
//Add an event to destroy the created batch, and then call it from where ever you want.
mp.events.add("client_batch_destroy", () => {
batch.destroy();
mp.console.logInfo(`Entity overlay batch was destroyed successfully.`);
})