AnimationControllerAutoRecycle Method |
Namespace: DigitalRune.Animation
Objects of type AnimationInstance are automatically created when a new animation controller is created. The animation instances maintain the runtime-state of the animations. The animation instances can be recycled when they are no longer used. They can then be reused by the animation system for future animations.
It is recommended to recycle animation instances in order to reduce the number of memory allocations at runtime. Animation instances can be recycled explicitly by calling Recycle. Or, they can be recycled automatically by calling AutoRecycle or setting the property AutoRecycleEnabled to . If AutoRecycleEnabled is set, then the animation system will automatically recycle the animation instances once the animation has stopped.
The method Recycle can be called at any time, regardless of whether AutoRecycleEnabled is set. The property AutoRecycleEnabled can also be changed at any time - it will only take effect when the animation stops.
Once the animation instance has been recycled the struct AnimationController becomes invalid. The property IsValid indicates whether the animation instance is still alive or has already been recycled.
Note that calling the methods Recycle, AutoRecycle, or setting the property AutoRecycleEnabled has no effect if the animation controller is invalid.