Modular development is a huge part of software design. Updates, Downloadable Content, Expansions, Sequels, or just continued development of a project will all see the benefit and use of modular systems.
These systems are “Modular” because they are made with the intent to be added onto or changed throughout development in order to fit the needs of the various parts of the project. You have probably seen or used concepts like this when implementing variables that utilize the “[SerializeField]” attribute. These variables allow the other developers to easily and personally customize things like movement speed or firing rate within the inspector and in accordance with any changes or adjustments that they found needed to be implemented.
So why would anyone want to make a powerup system that is modifiable? Well, that’s easy. What if the developers wanted to add in another powerup later on? Or maybe they find that the powerups you are currently using should be changed or replaced with something that works better for that game? Either way, you will need to have something set up to easily add or remove parts of your system on the fly.
So how do you do this?
One option is to use if statements along with an “Integer” type variable. Just make it serializable and set each powerup to a different ID in the inspector.
Another option is to use a “Switch” statement.
But I’ll go into these in more detail in the next article. Thanks for reading, and stay tuned for more content daily!