Bullet Magazine
The BulletMagazine
is a classic ammo system used in most traditional firearms. It inherits from the base Magazine
component and introduces functionality for reloading, both manually and automatically.
This magazine tracks a finite number of bullets (the clip) and requires a reload when empty. It also exposes events for integrating reload animations, sounds, VFX and more.
✅ Ideal For
- Pistols
- Assault rifles
- SMGs
- Shotguns
⚙️ How It Works
- The barrel checks if there is at least 1 bullet left in the clip.
- When a shot is fired, the clip value is decremented.
- If the clip reaches zero:
- The
On Depleted
event is triggered. - If Auto Reload is enabled, the reload process begins.
- The
- When a reload is triggered, the
On Start Reload
andOn Reload Complete
events fire in sequence.
📐 Inspector Overview
Field | Description |
---|---|
Clip | Current number of bullets available |
Clip Size | Maximum capacity of the magazine |
On Depleted | Event triggered when the clip reaches zero |
On Start Reload | Invoked at the start of a reload sequence |
On Reload Complete | Called when the reload finishes and the clip is refilled |
Auto Reload | If enabled, reloads automatically when the clip is empty |
Reload Time | Time in seconds required to complete a reload |
Reloadable | If disabled, the magazine cannot be reloaded (useful for disposable or one-time weapons) |
🎮 Integration Tips
- Hook
On Start Reload
to reload animations or sound effects. - Use
On Reload Complete
to reset visuals or play reload confirmation sounds. - Combine with HUD elements to show remaining bullets in the clip.
- try to sync the reload time with the animation’s length