MOST Spawn
The ultimate solution for objects generator. you can use it to Spawn Enemies, Set game objects' start positions in awake, Generate points, Create patterns, and a lot more. Also, it comes with a debugging system, so you can set the area or points you want to spawn in. It's easy to set the target area or target point.
Check MOST Spawn video to know how to use it in your game (better than reading)
_____ * How to import and use the MOST Spawn System? * _____
1- Create an Empty object in your scene
2- select this object and tap Add Component
3- select Most_Spawn.cs and now you are ready to go
Note:
The debugging system uses Gizoms drawer so make sure it turns on on the scene view
You can change the drawing settings from Most_Spawn itself
The game object that contains the spawn system will be the center point of the spawn area (the shaded area is the spawn area)
_____* How to set up the spawn area? * _____
Spawn shape: the spawn area shape from the inner and outer. control the scale of this shape using the Inner Scale and Outer Scale. Height is for 3d shape if you want to build a 3d spawn area.
Note: Inner and Outer scales for X and Z axis... Height for Y axis.
Ignored positions layers: The system checks if the selected point is collided with another object if the object is selected by Ignored position layers the system will ignore this point and find another what can you do with Ignored positions layers?
Stop spawn objects overlapping when the spawned object's position collapses with the next spawn point the system will ignore this point and find another to prevent two spawn objects and the same position (or so close to each other)
Prevent Spawning above other objects like walls, water, moving objects like characters, and all objects you want to ignore its collision area
shaping complex spawn areas you can use empty objects to draw a complex area and use it to prevent spawning in certain areas inside the spawn area.
Snap Position: instead of floating point, separate the spawn area to gird points check Enable Snap and the debugger will draw the new target spawn points it's so easy to modify your shape with the debugger drawer anyway :)
_____ * How to set up spawn rate and cycle settings? * _____
Let's take a look at Cycle properties
Repeat System: spawn cycles controller 1- Loop forever 2- Limited Cycles
Amount System: spawned objects flow system
Divided By Cycle Time: means the amount spawned per cycle will be split between the cycle time
Single Swarm: means the amount spawned per cycle will be generated at once at the start of the cycle
Spawn Rate Per Cycle: the number of objects that will be spawned for each cycle
Cycle Time: the cycle time in seconds
Rest Time Between Cycles: the cooldown time between cycles (between the end of the current cycle and starting the new cycle)
Number of Cycles: (Only if the Repeat System is Limited Cycles, -1/infinity if loop forever) the number of spawn cycles for this system and after finish the spawn system will be terminated (but it can rework again "Check API at the end of this page")
First Cycle Delay: the delay before activating the spawn system and starting the first cycle (useful at the auto spawn enable and create patterns for multiple spawn systems)
_____ * Spawn Object Rotation * _____
The target rotation has four options
No Rotation: the spawn object rotation will not be affected and will be the same as its prefab
Look At Inside Spawn Area: the object will get a random rotation between min and max range starting from the center point of the spawn area
Look At Outside Spawn Area: the object will get a random rotation between min and max range starting from the opposite of the center point of the spawn area
No Target Rotation: the object will get a random rotation between min and max range
Note: each range is from -180 to 180 and "Target Rotation" Is just centering the target area
_____ * Limit the active spawned objects in the scene * _____ if the number of objects in the scene reaches the "Max number in the scene" the spawn system will stop spawning until the number of objects gets lower than the maximum value (object destroyed/removed)
Note: The limit system only counts the active objects (the destroyed/removed objects are not counted) see examples on MOST Spawn video
Event system: There are event system callers for each spawning event, you can set your functions and calls
On Cycle Start Event: Called at the start of a new cycle.
On Cycle End Event: Called when the current cycle ends.
On Spawn Called Event: Called when the system spawns a new object.
Note: when the rest time between cycles = zero... "On Cycle End Event" will be called immediately after "On Cycle Start Event".
Another Note: "On Spawn Called Event" will be called once in a single swarm system (multiple objects spawn at the same time).
Another one too 😄: Event system doesn't work with manual spawn calls or manual cycles setter and you have to call it manually as well (logically it has to be this way to make it optional), check the API at the end of this page.
__________ * Examples * __________
there are unlimited variations of spawn usage, here are a few examples and there will be more in the future
__________ * API * __________
Note:
all public properties can be updated in runtime and the changes will be set immediately.
This is the only API on MOST documentations shows the core cs properties.
Last updated