The term “Factories” comes from the factory design pattern. Factories are objects which can create new instances of certain types of Entities. Factories have two main benefits:
- They can be automatically associated with a PositionedObjectList so when you instantiate an object you don’t have to manually add it to a PositionedObjectList.
- They can pool Entities which can greatly reduce allocated memory for Entities which are created and destroyed frequently.
For a tutorial on how to use factories, see the Created by Other Entities tutorial page.
Factories Generated by Glue
Glue will automatically generate factories for any entity which has its Created by Other Entities property set to true.
For information on this property, see the CreatedByOtherEntities page.