EntityOverlayBatch:valid
Client-Side Function
JavaScript Syntax
This property will return whether an entity overlay is valid or not.
- Note: This property is readonly.
Return value
- boolean
Syntax
batch.valid
Example
//Enable entity overlay
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) => {
//check if entity overlay is valid before adding a new entity to it
if (batch.valid) {
batch.add(vehicle);
}
});