I want to use a factory class to dynamically generate various enemies, so I checked the “Dynamic Prototype” option, allowing me to set factory.set_prototype("#factory", "/xxx/xxx.goc")
anytime and anywhere. This is good, but the path part is in goc compiled format. Since I don’t plan to add any enemy instances during editing, without adding instances, no goc files will be generated. Without goc files, I can’t dynamically generate them. Therefore, my approach is to pre-add all enemy instances to a collection in an area that the camera will never enter, so the engine can compile the corresponding goc files for me to use. What is the reasoning behind this design, and what would be the most elegant solution?
Since different enemies may need to be generated multiple times per second, would it be more advisable to use a separate factory class to generate each enemy in this case?