Stores
To ensure persistance across event calls data can be put into stores(javaScript objects associated with game/gameObject/component instances).
At global level
gameInstance.store
object is accessible accross different root gameObject.
At gameObject level
gameObjectInstance.store
object is accessible for a particular gameObjectInstance. Each instance has a unique store.gameObjectInstance.commonStore
object is shared across all the instances of a gameObject. So all references to this gameObject will share this store.
At component level
componentHelper.store
object is accessible for a particular component instance. Each instance has a unique store.componentHelper.commonStore
object is shared across all the instances of a component. So all references to this component will share this store.
TIP
Use commonStore
s for caching or instancing.