Accepted answer

you shouldn't be calling the remove method in the middle of a block of code in the object your are removint; even though it is removed it will attempt to finish the code but will fail because all of it's variables would then be null. to fix this error, i suggest adding a boolean called removed in your gameobject class. instead of calling handler.removeobject(this) simply set removed equal to true. you then need to add a few lines of code in your handler class in the tick() method to check for and remove all objects with a removed value of true. something like this

for (int i = 0; i < object.size(); i++) {
     if (object.get(i).removed)

Related Query

More Query from same tag