How to add the inventory to a player
There is a unity Dialog which helps you to fill out the relevant fields on the components and adds them to the player.
You can start the dialog by selecting the menu “Tools–>NononZone->Multiplayer” or “Tools–>NononZone->SinglePlayer”. After filling out the relevant fields this adds the required components to your player.
- Player: This is the player component, where the components will be placed.
- Player Model: The model of your player. This is normally the parent of the Armature. Here the Armor will be placed and attached to the bones.
The layer of this node and all childs is changed when the inventory is opened. When the inventory is closed the layer will be changed back to the default set to the PlayerEquipper Component.
There are four slots avaible to put weapons to. Each of the slots can have one or more entries to put weapons into. Each entry has three fields. Two of them need to be filled.
- Weapon Holder: This is where the weapon is kept when not used but equipped (back, hip, leg etc)
- Weapon Target: If the weapon is drawn, the weapon is moved to the target transform
- Weapon Alt Target: You can switch the weapon from the target to the alt target and back. This is used if you for example want to equip a two hand gun with IK Bones.
If you hit Add to player, the following two components and the UI Prefab are added to the player. The scripts are different for multiplayer and for singleplayer.
The Player Model UI Layer is the layer that will be set, when the inventory is opened and the Orig Player Model Layer is the layer that is set when the inventory is closed again.
This is necessary to show only the player in the inventory UI and not some background.