In this section you are going to learn more about the weapon structure.
Overview
Weapons play a very important role in the demo project, as they play reloading animations, handle the firing and attachments at the same time.
All weapons and items are derived from the FPSItem class - it contains a general interface for all entities, and its methods are used by the FPSController to start an action. For example:
In this snippet, when we receive an OnCycleScope event from the Unity Input System, we effectively call the general OnCycleScope method on our currently equipped item. The implementation might differ, depending on the actual item the character is holding.
You can leverage this behavior to implement custom functions for each character action.
Weapon Spawn
All weapons and items are spawned when the game starts, it happens in the FPSController: