Spawner
Most games need some sort of object spawner. The internal spawn logic can look a bit different depending on scenario and context. This is why we created a scalable and modular Object Spawner.

Underlying all spawners is the ASpawner script. This is an extendable class that handles all the boring setup logic for a spawner. But, because of this, the direct inheritance could be abit difficult to grasp. Therefor, we created some sub-spawner systems to allow you to get the ball rolling faster.
To understand how we can create a new spawner to spawn a specific type, we can extend the SpawnpointsSpawner and create a script that spawns Balls.
// we extend SpawnpointsSpawner which requires two "arguments":
// 1: type to spawn (Ball) 2: the current type (BallSpawner)
public class BallSpawner : SpawnpointsSpawner<Ball, BallSpawner>
{
public override Ball Spawn(Object obj, Vector3 point)
{
return Instantiate(obj.obj, point, Quaternion.identity); // instantiate the object.
}
public override void Dispose(Ball copy)
{
base.Dispose(copy); // must call.
Destroy(copy.gameObject); // destroy the game object.
}
}Spawn object
To spawn an object from another script we simply need to call:
List of all pre-made spawners
Create custom spawner
Sometimes, the pre-made spawners are not enough and you would like to create your own spawning logic. Here's how:
Last updated