Knowing if an instance is still around

I have some code that time slices raycasts, so instead of raycasting immediately a go will ask to be queued for raycasting and then a raycast is performed and the result is sent back to the instance. However when this is used by enemies they can be killed between the time they ask for a raycast and the time the result is sent back, causing a lot of

ERROR:GAMEOBJECT: Instance ‘/instance362’ could not be found when dispatching message ‘ray_cast_response’ sent from game:/map/level#script

While this is not a big issue since the player won’t know it clutters the console immensely and I am in the debug version there is of course a performance hit for writing to the console (though I hope this is not persisted to bundled versions?)

Anyway - to the question: Is there a way to check if an instance exists before attempting to communicate with it?

Hi!

No, there is no way to query an object if it exists, but is it possible to have the killed GO ask to be removed from the ray cast queue?

(Generally, since everything happen asynchronously there is no guarantee that an object exist when the response arrives. You can send a ray cast and do go.delete() immediately after, for instance.)

I do not think I could efficiently remove it from the queue (and that would be a performance hit, and since this really only applies to debug builds that seems a bit unnecessary). I guess what I would like then is some way to filter messages from the engine to the console by type (so I can filter away warnings)