How to enumerate a collection? (SOLVED)

Hello,

I wonder if it’s possible to enumerate a collection.

I’ve looked into the API the go functions table, but it doesn’t seem possible.

If my collection is named ground_collection and inside i have game objects like ground00ground06 , i can do:

print( go.get_id("ground00")) which returns the id.

but

print(go.get_id("ground_collection")) returns an error code.

I want to do this for applying the same operation on all the game objects of a collection, without the need to list them in a table (i’m doing the runner tutorial if you wonder :slight_smile: ).

As the collection have a name property, i guess i can do something with it.

Thank you for reading.

Collections do not exist at runtime. You’ll have to keep track of lists of things as you generate them with factories or have child units placed in the editor communicate with a manager on init.

3 Likes

Thank you.

I haven’t used collection factories yet, but i see the idea.

(generate names for go produced by the factory, and store them in a list).

1 Like