The inventory and item system allows for multiple items to be equipped at the same time. As each item is equipped they will occupy a slot within the inventory. Because there isn’t a limit to the number of slots that a single character can have there isn’t a limit to the number of items that can be equipped at the same time. In most cases the most number of items that a character will have equipped at any one time is two, left and right hand, so this page will setup that scenario.
For this example we are going to setup a sword and shield that you can dual wield. The initial item setup is the same as a single-wield item. Both items should first be created with the Item Manager. The Sword should specify a Slot ID of 0 (for the right hand), and the shield should specify a Slot ID of 1 (for the left hand).
Once both items have been created an ItemSetRule must be created to define how the items can be equipped together. This can be done by using an ItemTypeItemSetRule:
When the Item Set created by the rule is active the Equip Unequip Ability will try to equip the sword in Slot 0 and the shield in Slot 1. In most cases this is all that you need to do, however for the first person perspective you have some additional options based on which parent Object you are using.
First Person Dual Wielding
For the first person perspective all of your items can share the Object within the First Person Perspective Item component. If however your item can be equipped with other items it is useful to have the item use its own object so each hand can operate independently. This was the approach that we took for the Sword Shield setup. If you look at the First Person Objects hierarchy you’ll see that the Shield is parented to just the Left Arms:
When the Shield is equipped the AtlasFirstPersonLeftArms object will activate and be controlled by the shield’s First Person Perspective Item component. This allows the right arms to operate independently.
After creating the items you would like to equip together there are two options on how to setup items to be added to the the arms.
Sword & Shield
- Set the Sword FirstPersonObjectID to a value of 0 for the FirstPersonArms object:
- Set the Shield First Person Base Object ID to the a value of 1 for the FirstPersonLeftArm:
- To avoid having the Left Arm show up twice while the Sword and Shield is equipped add an ObjectActivator component and add three states to disable the Left Arm Skinned Mesh on the FirstPersonArms.
- Set the PistolRight to the FirstPersonRightArms.
- Set the Additional Control Objects to the FirstPersonArms to show the left hand while only the right pistol is equipped. The FirstPersonArms have an ID value of 0.
- Set the PistolLeft First Person Base Object ID to the FirstPersonLeftArm which have a value of 1.
- To avoid having the left arm show twice while the dual pistols are equipped add an ObjectActivator component and add two states to disable the LeftArm SkinnedMeshRenderer and disable the RightArm SkinnedMeshRenderer on the FirstPersonArms.