I was reading the tutorial on adding GO at runtime and also removing them on for example reset.
I thought I can do something similar with entire collections.
I was following the documentation for spawning a collection at runtime:
But there is no information on removing them again. And since the collection factory is not returning a single ID, I don’t even know how to reference the collection.
Another tricky part was to find the correct item in the table of spawned collections.
I am sending the id of the GO that had a collision and find it in the collection.
for i,p in ipairs(self.spawned_bullets) do
if p[hash("/bullet")] == message.id then
table.remove(self.spawned_bullets, i)
go.delete_all(p)
end
end