Asset pending release
Documentation is a draft, and does not relate to the preview version.
3.5.Runtime
None of the core functionality in this asset is editor-only, so spawning in play mode (runtime) is absolutely possible.
Respawning will take place when altering any of the splines in the assigned Spline Container
.
If you are making changes to the Spline Spawner
component through script, such as adding/removing objects, changing distribution settings or modifiers. Be sure to call the Respawn()
function afterwards to apply the changes.
You can browse all the available functions and fields in your IDE. Press CTRL+Space after the ‘.’ (period) to do so:
Performance Considerations
Spline alterations
Whenever a Spline changes, it’s required to cache it by reading it out over it’s entire length and convert the data into a format usable by the Job System (eg. native arrays). Once this process has completed, the spline data will be used extremely efficiently for spawning.
But, the process itself is relatively costly. This means that respawning that happens based on spline changes is slower than just respawning by calling the Respawn()
function.
Object pooling
The instantiation of objects is based on Object Pooling, which greatly improves the spawning performance. Though, when the pool is empty, and a Spline Spawner is prompted to spawn several thousand of objects the pool has to be populated with entirely new GameObjects, which negates the performance benefits for the first spawning operation. After which, the spawning of objects can be up to 20x faster.
On any Spline Spawner component you can call the WarmUpObjectPools(int capacity = 1000)
function in order to emulate that first, slower, spawning operation. Or the static SplineSpawner.WarmUpAllObjectPools()
function to do this for all active Spline Spawner components.