Change prototype in factory (SOLVED)

Hi, is it possible via scripts to change the prototype assigned to a factory for creation?

I’m trying to have a unitMob.factory spawn dynamically from a list of 20+ mob gameobjects, is this the correct way to go about it?
Or do I need to setup a factory for each mob unit instead?

Sorry I’m still fairly new to both defold and lua here, please bear with me.

No, the prototype is static. You can either set up a factory for each type or spawn a gameobject or the content of a collection (collectionfactory) and control the initial state through init properties provided through factory.create().

1 Like

Cool, guess I’ll have to work around this then.
Thanks for the clarification :smiley:

1 Like

It is possible now since Defold 1.4.3

Manual:

Example:

1 Like