Skip to main content

Weapon View

WeaponView extends GameplayItemView with firearm presentation. It does not perform hitscan, projectile simulation, damage, or authoritative ammo logic. The Animations tab pairs character and item assets for draw, holster, tactical and empty reload, inspect, fire, empty fire, aim in, and aim out. It also configures default/aim FOV, recoil data, camera shake, and the ADS aim point. The VFX tab references ParticleSystemPlayer components for muzzle flash and empty casing effects. PlayFireEffects starts the muzzle flash. Animation events or gameplay code can call PlayEmptyCasing when the casing should appear. The Sounds tab randomizes fire clips, pitch, and volume within the configured ranges. It also stores fire-mode, aim-in, and aim-out sounds.

Runtime event flow

Specialized views

RevolverWeaponView selects a partial reload by comparing active ammo with capacity. It falls back to the normal empty or tactical reload when the required entry is unavailable. ChargeWeaponView uses Burst mode as a charge interaction. It plays charge-start, loops the charge animation and audio, and fires when use stops. Its animated charge property can drive product-specific VFX. ShotgunWeaponView sequences reload start, shell loop, reload end, and pump actions. It reads IWeaponAmmo to stop when the weapon reaches capacity and uses fireLength to decide when a pump is required. OnReload returns -1 because the shell loop has no fixed total duration.

Ammo contract

Weapon views read IWeaponAmmo from the same GameObject. Your gameplay weapon may implement this interface instead of using the example:
Keep ammo mutation in gameplay code or animation events appropriate to your reload design. The view reads the interface to select presentation.

Sci-Fi implementations

Each prefab also includes a matching Example component that drives the view in the supplied demo. See Item views for every view/example pairing and Examples for the implementation boundary. Duplicate the closest prefab when creating an item with similar presentation. Replace inventory, ammo, firing, damage, and networking logic independently from the view.