When an object is deleted by the factory, add it to a list of pending deletes. Then clear the list after the main update. This will prevent references to deleted objects. Will also prevent updates in the middle of a physics collision (there is already an open issue for this).
When an object is deleted by the factory, add it to a list of pending deletes. Then clear the list after the main update. This will prevent references to deleted objects. Will also prevent updates in the middle of a physics collision (there is already an open issue for this).