Need help with using Factory Dynamic Prototype

I am trying to dynamically change the prototype of a Factory (with the “Dynamic prototype” set to true). Let’s say I am randomly choosing between spawning enemyA.goc and enemyB.goc.

Problems/weirdness I am running into:

  1. I cannot leave the prototype path blank on the factory. The game would not run as it has an error saying I need to assign something. I could assign enemyA.go or enemyB.go here, but seems weird to me that I have to assign something to it if it’s already marked “dynamic prototype”, indicating that it’s intended to be changed at runtime?

  2. Let’s say I assign enemyA.go as the factory prototype. Now building the game does not generate enemyB.goc in the build folder, and I am guessing because nothing in the game is referencing enemyB.go. Am I supposed to explicitly reference all the .go / .collection that I want to dynamically assign to prototypes? If so that seems really cumbersome. What am I missing?

Thanks!

This is what you have to do. The intended purpose of this feature is not really what you are trying to do. The main use case for this feature is to have a factory with a default prototype game object, and then use this feature in combination with live update to download additional content (seasonal content, paid dlc, etc) and replace the default prototype with content from the downloaded asset pack.

In your case I’d actually have two factories and at runtime choose which one to use.

5 Likes