ParticleSystemPreloadDuration Property |
Namespace: DigitalRune.Particles
[ContentSerializerAttribute(Optional = true)] public TimeSpan PreloadDuration { get; set; }
Usually, particle systems start with no particles and particles are added over time. But for some particle systems in a game, the start should not be visible to the user. For example, when the player encounters a waterfall, the waterfall should already be running and not slowly start in front of the player. Such particle systems need to be preloaded.
If Update(TimeSpan) is called for the first time or after a Reset and PreloadDuration is greater than 0, the particle system will automatically advance its state by executing Update(TimeSpan) internally several times. For each internal Update(TimeSpan) call the PreloadDeltaTime is used as the time step size.
Preloading during the first Update(TimeSpan) can take a significant amount of time. It might be better to make the first Update(TimeSpan) call while a game level is loading to avoid any slow-downs at runtime. Setting PreloadDeltaTime to a larger value will also reduce the needed time for preloading.