Adding Magazines
A magazine is simply a GameObject with a Magazine
script attached to it. This script manages how many bullets the weapon can fire before needing to reload, and handles the reloading process if one exists. Magazines can also be configured to act as rechargeable energy cells or infinite sources, depending on the weapon design.
🔘 Choose the Magazine Type
For this pistol, we’ll use a Bullet Barrel, which is the typical gun clip model with a simple reload.
🎯 BulletMagazine prefab is included in the package under
modularweaponsystem/content/Magazine
📦 Drag and Drop the Magazine
- Drag and drop the
MagazineBarrel
under thePistolModel
in the prefab.
📍 Position the Magazine Object
- Position the magazine in a way that makes sense in the gun. This is not necessary, but recommended for organisation. For this example we will place our magazine object at the clip of the pistol.
Just like barrels, multiple magazine types are supported. You can create custom magazine behaviors by extending the base script.
⏭️ Next Step
Now that we have the barrel and the magazine set up, we simply need to reference them so they work in harmony together.