What an ItemView represents
An ItemView is the presentation component on an equipped item prefab. It coordinates what the player sees and hears when gameplay equips, uses, aims, inspects, or holsters that item. The view does not represent an inventory record or authoritative gameplay object. It does not decide ownership, damage, hit detection, ammunition persistence, networking, or whether an action is allowed.Base ItemView
GameplayItemView is the base presentation class. Keep it on the same GameObject as the itemโs Animator.
During Awake, the view:
- Caches its original local scale and parent
GameplayAnimationController. - Finds the item
Animator. - Builds an animation slot mixer over the Animatorโs playable graph, or creates a graph when the Animator has none.
- Caches child transforms for bone visibility.
- Plays
itemIdleClipas the base item pose.
Paired character and item actions
GameplayCharacterItemClip groups a character-side GameplayAnimationAsset, an item-side asset, and an optional sound. PlayCharacterItemAnimation starts both animation assets together and plays the sound through the playerโs AudioSource.
Use paired assets for draw, holster, fire, reload, inspect, throw, and other actions where the hands and equipped object must remain synchronized.
Equip context
OnEquipItem(player) resolves the active presentation context from the supplied player. When the argument is null, it uses the itemโs transform root.
The method then:
- Finds a child
GameplayAnimationControllerandGameplayCamera. - Applies the viewโs
proceduralAssetto the character controller. - Resolves any retargeted item scale from that procedural asset.
- Finds the context rootโs
AudioSourcefor item sounds.
Lifecycle contract
Return the animation length for actions that should block other actions. Return zero for no blocking action. A specialized sequence may return a negative duration and stop the controller action itself when the sequence actually finishes.
Bone visibility
HideBoneByName and UnhideBoneByName preserve the transform hierarchy and animation bindings. Hidden transforms are scaled to 0.001 during LateUpdate. Use this for magazines, cartridges, or throwable parts that animation events need to hide without deleting or disabling the animated transform.
In the current implementation,
UnhideBoneByName stops forcing the small scale but does not restore the cached default scale itself. The animation or your event code must write the visible scale again.GameplayItemExample
GameplayItemExample is a reference adapter, not the item presentation itself. It finds GameplayItemView on the same GameObject and forwards equip, unequip, aim, use, stop-use, and inspect calls.
The supplied GameplayControllerExample uses that adapter to demonstrate one complete loop:
- It instantiates each configured item prefab below the mapped weapon bone.
- It hides every item and equips the active one.
- It forwards Input System callbacks to the active Example component.
- It uses durations returned by equip, holster, and inspect to block overlapping actions.
- On item change, it waits for the current viewโs holster duration before equipping the next item.
Included Sci-Fi item views
Every supplied item prefab combines a concrete ItemView with the Example component that drives it in the demo player.Choose a reference implementation
Start from the prefab whose presentation sequence matches your item:- Use
W_GepardorW_RPG90for a conventional weapon usingWeaponView. - Use
W_ARX_Mk2for an energy weapon that charges while use is held. - Use
W_Onyxwhen reload selection depends on missing rounds. - Use
W_TP12for an open-ended, shell-by-shell reload. - Use
W_M97for a held throwable or another start-loop-release interaction.
ARX Mk2 energy charge rifle presentation fields.
Onyx partial reload entries on Revolver Weapon View.
Weapon runtime
Configure the Shooter Core view fields and specialized firearm behavior.
Example implementations
Adapt the supplied Example classes to your gameplay architecture.