Custom ID for Instances Created with CollectionFactory

Hello Defold Community,

I’m currently working with collectionfactory.create to dynamically instantiate collections in my game. I was wondering if there’s a way to assign a custom ID to these instances for easier management and reference. I’ve looked through the documentation but couldn’t find a direct method for this. Does anyone know if Defold supports this functionality, or is there a recommended workaround to achieve similar behavior? Any guidance or tips would be greatly appreciated!

Thank you!

There is no such functionality.
These ID’s come from a pool of ID’s and are reused throughout the lifespan of the application.

I suggest you put your id’s in a table for easy reference:

local t = { my_game_object = my_id }

Then you have a custom name to use when looking up the game object id.

4 Likes

ok thanks for the suggestions!

Moreover, I realized that for my specific case, it’s probably better if I use a proxy collection where I can have control over the naming.