Gameplay Framework and Shooter Core components on the example player.
What the Example classes are for
The Example classes are executable reference implementations. They show how gameplay code can drive the animation and item presentation APIs, but they are not required base classes for your game. Use them to answer three questions:- Which controller values must gameplay update?
- Which ItemView lifecycle method corresponds to each gameplay action?
- How should returned animation durations block incompatible actions?
GameplayControllerExample
GameplayControllerExample demonstrates a complete local character loop:
- Input System callbacks for movement, look, lean, jump, crouch, walk, sprint, free look, use, aim, inspect, and item switching.
CharacterControllermovement with ground checks, coyote time, jumping, falling, air acceleration, crouch clearance, and stance transitions.- Animator parameters for gait, movement direction, aiming, crouching, jumping, and in-air state.
- Per-frame updates to
GameplayAnimationController.moveInput,lookInput,deltaLookInput,leanInput, andisAiming. - Instantiation of configured item prefabs below the skeletonโs mapped weapon bone.
- Action sequencing through returned durations,
StartAction,StopAction, andHasActiveAction.
GameplayItemExample. It instantiates valid prefabs, hides their ItemViews, and equips the first item.
When the player changes items, it calls UnEquipItem on the active Example, waits for the returned holster duration, advances the item index, and calls EquipItem on the next Example.
GameplayItemExample
GameplayItemExample is the gameplay-side adapter used by the reference controller. It caches GameplayItemView from the same GameObject and forwards:
The adapter has no inventory identity, cooldown, damage, ammo, or networking logic. Its purpose is to make every item look uniform to
GameplayControllerExample.
How to use the examples
Use the examples in layers:- Compare your input and movement code with
GameplayControllerExampleto verify the values sent intoGameplayAnimationController. - Compare your inventory equip flow with its instantiate, hide, holster, delay, and equip sequence.
- Copy only the ItemView lifecycle calls required by your item.
- Keep your own authority and state decisions before those presentation calls.
ShooterControllerExample
ShooterControllerExample extends GameplayControllerExample with reload and fire-mode input. It treats the active item as WeaponExample, stops held fire before reload, and rejects reload or fire-mode changes while another controller action is active.
This class demonstrates input orchestration. It does not implement projectiles, hitscan, damage, weapon ownership, or networking.
WeaponExample
WeaponExample is the gameplay-side reference paired with WeaponView. Both components live on the same weapon prefab.
The class implements
IWeaponAmmo. WeaponView finds that interface on its own GameObject and reads it to choose loaded or empty fire clips and tactical or empty reload clips.
The example owns demo cadence and ammo mutation:
UseItemvalidates active ammo and the fire-rate delay.Firesubtracts one round, callsWeaponView.OnUseItem, and schedules another shot when the selected mode requires it.StopUsingItemcancels scheduled shots and stops recoil through the view.Reloadasks the view to select and play the correct reload presentation.ChangeFireModecycles only through modes enabled by the component fields.
ChargeWeaponExample
ChargeWeaponExample specializes the demoโs Burst mode into hold-to-charge behavior:
- Pressing use calls the view without immediately subtracting rounds.
ChargeWeaponViewplays charge-start and then repeats the charge loop.- Releasing use subtracts
burstRounds, callsPlayFireEffects, and stops the charge loop.
WeaponExample cadence. Treat this as the reference for the energy charge rifle, then connect the release event to your own ammo and firing authority.
Implement the same boundary
Your production gameplay component may replaceWeaponExample entirely. Keep an IWeaponAmmo implementation on the same GameObject as WeaponView if the view should select loaded, empty, or partial presentation from current ammo.
Supplied reference setup
The player reference isAssets/KINEMATION/SciFiPack/Prefabs/Player/FPS_SciFi_Arms.prefab. Its item list instantiates the six supplied W_* prefabs below the mapped weapon bone.
Each item prefab carries two distinct components:
- A concrete ItemView that owns presentation.
- An Example component that demonstrates gameplay state and calls the view.
Adapt an example
1
Run the reference prefab
Test equip, holster, aim, use, stop-use, inspect, reload, and item switching before replacing code.
2
Trace the call boundary
Start at the Input System callback, follow the active Example component, and note the ItemView method it invokes.
3
Replace gameplay state
Move inventory, ammo, cooldown, projectile, damage, authority, and networking decisions into your own gameplay classes.
4
Preserve presentation calls
Invoke the matching ItemView lifecycle after your gameplay validates the action. Use returned durations to prevent incompatible local actions.
5
Remove the Example component
Remove it once your implementation supplies every required controller value and view call.