Download Projectile Spawner

Role

Design, Scripting

Project Duration

1 week

Technologies Used

  • Unity 2021
  • Visual Studio Community 2019

Projectile Spawner

This was a fairly quick, simple exercise I took on in my free time. The idea was simply to create a generic projectile spawner suitable for a "bullet hell" style top-down shooter, which would be flexible and easy to use. To this end, it offers a significant selection of options in the Unity inspector, organized into groups and typically constrained to a logical range. With options like positional and radial offsets, rotation, multi-directional fire, cone fire settings, sweeps, and timed burst fire, it's possible to create a wide range of patterns; combining multiple spawners, possibly with varying projectile types, further expands the possibilities.

A significant design decision I made here was to decouple the projectiles from the spawner as much as possible, with the spawner having only a reference to a manager that handles pooling through Unity 2021's new ObjectPool type. Because of this, projectile scripts and prefabs are responsible for defining the behavior of individual bullets, and the spawner only controls when and where they are spawned. This offers the advantages of proper separation of responsibilities and minimizing the data that each of a potentially large number of projectiles needs to contain, and keeping the spawner's options focused on spawning. The tradeoff is of course that the designer loses out on a range of possibilities related to the behavior of projectiles after spawning, unless they are each configured outside the spawner through appropriate scripts and prefabs. Because of this, this tool would be most suited to a game with a relatively small number of well-defined projectile types; a game that wants to be more experimental in this regard would benefit from significant modifications to this system with that requirement in mind.