Creating Modular Powerup Systems

Deon Jr.
2 min readMar 25, 2021


Day 6.

We currently have only one powerup implemented, the triple shot. We obviously want more.

We could just make a new script to attach to the gameObject, like we did with the triple shot, but we are going to take a modular object oriented approach.

To do this we will be using our existing powerup script and we will use IDs to identify which powerup is which, thus telling our script which code needs to be triggered for that specific ID.

First we add an integer called powerupID to our script, and we add a SerializeField so we can assign it in the inspector.

Now we have the option to add a unique ID to each of our powerups allowing us to trigger specific code from a single powerup script.

This is the basic code to trigger each powerup based on which ID is detected on trigger.