Factory

Introduction

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:

  1. 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.
  2. They can pool Entities which can greatly reduce allocated memory for Entities which are created and destroyed frequently.

Tutorial

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.