I have a problem where the comparison between a game object’s id before and after go.delete() differs depending on how the game object was created. I guess getting the id after go.delete() might be a bit silly, but since it’s not deleted until the post update (?) I thought it’d be OK.
Here’s a script showing the problem (attached to the go):
function init(self)
msg.post(".", "acquire_input_focus")
self.id = go.get_id()
end
function on_input(self, action_id, action)
if action.pressed then
go.delete()
print(go.get_id() == self.id) --false if the go is in a collection created from a collection factory, otherwise true
print(go.get_id(), self.id) --prints the same hash twice no matter how the go is created
end
end
Putting the game object (1) directly in the bootstrap collection, (2) in another collection in the bootstrap collection or (3) creating the game object with a factory all yield the same result: The id comparison returns true. However, when I put the game object in a collection that is created using a collection factory, the ids are different in the equals operation even if they look the same.
What happens directly after deleting the game object and why does the behaviour differ depending on how the game object was created?