Check to see if an entity still exists at a handle

Blitz3D Forums/Blitz3D Programming/Check to see if an entity still exists at a handle

The problem of multiple handles pointing to an entity happens to me all the time. For example, in one recent project I had a type for all the tanks. The tanks store, as one field in the type, the handle of the object they are targetting. But this resulted in a MAV if multiple tanks target the same object and one of them destroys it.

An addition to EntityClass to handle invalid handles would be really handy for situations like this, but in the meantime note that attempting to access a type instance that has been deleted results in a 'null' response, not an error. So the workaround I use is to refer to the type instance that has the handle of the entity, not the entity's handle directly. When I free the entity I also delete the type instance. Thus, anything else attempting to refer to the type instance gets a 'null' response.