Introducing the Triple Laser

New Weapon

Gert Coppens
3 min readSep 1, 2021

In this article I’ll introduce a new weapon, the Triple Laser. Although it has a slower fire rate this weapon has the ability to fire three shots at once.


For the time being, I’ve added a few Inspector fields making it easier to make different weapon prefabs using the same behaviour. For debugging purposes I’ve added a bool indicating whether we are firing or not (for code see below).

Object oriented

Creating the Triple Laser Prefab

First I created a new Prefab for the Triple Laser Projectile and tagged it with “Projectile”. This prefab holds three lasers, allowing us to instantiate just one GameObject instead of three.

Triple Laser

Creating the Triple Laser Weapon

To continue I created a new ‘TripleLaserWeapon’ Prefab, added the Weapon.cs to it, and assigned the new Projectile Prefab.

Triple Laser Weapon

The Triple Laser holds three normal Laser Weapons, for the Player it looks like this;

Player Prototype

In the hierarchy I also created a new parent ‘WeaponHolder’ attached to the Fighter jet, and made the weapons a child of this GameObject.

Player Hierarchy

Weapon.cs update

Added a drop down field, a description area, a fire delay scrollbar and a bool for debugging.

Asteroid.cs update

I also fixed a small bug; items where being dropped more than once due to two or more projectiles being inside of the trigger collider at the time of activation. Therefor I made sure the Item is only dropped once.

In the following article we’ll have a look at how we can switch between Weapons.

Previous | Next



Gert Coppens

Software Engineer — Unity Game and Application Developer