Lifecycle type for scenes and scene objects.
Objects supporting this lifecycle transition their states as follows:
+---------+ +------------+ +-----------+ +-------------+ +------------+ | LF_INIT |-->| LF_STARTED |-->| LF_ACTIVE |-->| LF_INACTIVE |-->| LF_STOPPED | +---------+ +------------+ +-----------+ +-------------+ +------------+ | | +---<-----<----<----+
Specifically, lifecycle objects are started and stopped only once but they can transition from active to inactive state more than once. When a scene starts it and its scene objects will be started, if they haven't been started before, and activated. When switching to another scene, the current scene and its scene objects will be deactivated. Scene and scene objects get stopped when either the entire game exits or an object gets removed.
The typical use case for the lifecycle events is resource initialization and disposal, logging, stats collections, etc. It is especially important in online games or the games that pull or stream online assets.
Note that when overriding the following callback methods make sure to call super
:
Attributes
- Companion
- object
- Source
- CPLifecycle.scala
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
-
class CPSceneclass CPFadeShimmerLogoSceneclass CPSlideShimmerLogoSceneclass CPSceneObjectclass CPCanvasSpriteclass CPDynamicSpriteclass CPAnimationSpriteclass CPImageSpriteclass CPBubbleSpriteclass CPCenteredImageSpriteclass CPLabelSpriteclass CPListBoxSpriteclass CPSpacerSpriteclass CPTextInputSpriteclass CPTitlePanelSpriteclass CPVideoSpriteclass CPOffScreenSpriteclass CPKeyboardSpriteclass CPLayoutSpriteclass CPSingletonSpriteclass CPParticleSpriteclass CPStaticImageSprite