defold icon indicating copy to clipboard operation
defold copied to clipboard

Set the collection component count when setting a dynamic prototype for a collection factory

Open Lerg opened this issue 4 months ago • 1 comments

Currently the default value is used. To optimize the memory it would be nice to have an option to set this count by code.

A good place would be an optional third argument to set_prototype().

collectionfactory.set_prototype('#factory', '/main/levels/level1.collectionc', 1024)

To improve the usability of this feature it would be nice to have another function that would tell the component count of a collection at runtime. In cases where it is already known, nil otherwise.

collectionfactory.get_component_count()
collectionproxy.get_component_count()

And what about collectionproxy.set_collection(), does it have the same issue as collectionfactory.set_prototype()?

Lerg avatar Oct 30 '25 12:10 Lerg

The plan is to add per-collection counts for the components. I couldn't find a previous ticket for it, so we'll keep this one for now.

Related issues https://github.com/defold/defold/issues/6668

JCash avatar Nov 03 '25 08:11 JCash