There are two ways an item can be added to the character through the Item Manager:

  1. Create the item with the Item Manager and assign the item to the character. This is the most common method and it requires all possible items to be added to the character at edit time.
  2. Create the item with the Item Manager and don’t assign the item to a character, resulting in a prefab of the item. This method is extremely useful for RPGs where there are many items to configure.

This page will walk through the second method. This page is split up into two sections, one for first person items and the other for third person items. If you are using both perspectives then both a first and third person item should be created in step 1.

First Person Perspective

  1. Open the Item Manager. Specify the following fields:
    • Name: The name of the item.
    • Item Definition: The Item Definition that provides a unique id for the item.
    • Slot ID: The slot that the item will occupy.
    • Animator Item ID: Optional, the Item ID used within the Animator.
    • Add First Person Item: True.
    • First Person Base: Optional, the arm object that the item should be parented to. If this field is left blank (which is the most common) then the item will search for the parent based off of the FirstPersonBaseObject component ID.
    • First Person Visible Item: The object rendered within the game.
    • First Person Visible Item Animator Controller: Optional, the Animator Controller for the First Person Visible Item.
    • Action Type: The type of Item Action to add to the item.

    The following screenshot provides a sample setup:

  2. Build the item to a new prefab. Select that prefab within the project.
  3. Because we left the First Person Base field blank we need to specify which object the Visible Item will be parented to. We are going to specify a value of 0 for the First Person Base Base field of the First Person Perspective Item component because we want to use the first person arms that are already created under the First Person Objects GameObject:
  4. The spawn position/rotation now needs to be specified. The best method for determining this value is to pickup the item with the Item Pickup component and then adjust the visible item’s transform while in play mode. Save the position/rotation values and then copy them to the Local Spawn Position and Local Spawn Rotation fields:
  5. Your item has now been setup to be picked up at runtime. This prefab should now be specified within an Item Pickup GameObject so the item can actually be picked up.

Third Person Perspective

  1. Open the Item Manager. Specify the following fields:
    • Name: The name of the item.
    • Item Definition: The Item Definition that provides a unique id for the item.
    • Slot ID: The slot that the item will occupy.
    • Animator Item ID: Optional, the Item ID used within the Animator.
    • Add Third Person Item: True.
    • Third Person Object: The object rendered within the game.
    • Action Type: The type of Item Action to add to the item.

    The following screenshot provides a sample setup:

  2. Build the item to a new prefab. Select that prefab within the project.
  3. The spawn parent needs to be specified. For this item we are going to spawn it in the character’s left hand so¬†we ensure Use Parent Humanoid Bone is enabled and then the Left Hand is specified. If this is false then the item will be spawned based on the Slot ID.
  4. The spawn position/rotation now needs to be specified. The best method for determining this value is to pickup the item¬†with the Item Pickup component and then adjust the visible item’s transform while in play mode. Save the position/rotation values and then copy them to the Local Spawn Position and Local Spawn Rotation fields:
  5. Your item has now been setup to be picked up at runtime. This prefab should now be specified within an Item Pickup GameObject so the item can actually be picked up.

Referencing Character Objects

When the item is spawned at runtime it isn’t able to reference the same objects that an item created at design time can. For example, the Shootable Weapon component can use the character’s hand to hold the reloadable clip. When the item is attached to the character at design time the hand can be specified directly on the Shootable Weapon Properties:

With runtime pickups this hand is no longer accessible so the Reloadable Clip Attachment ID field must be specified. This ID maps to the ID for the Object Identifier component. In this same scenario let’s now specify an ID of 1 on the properties component:

The Object Identifier should then be added to the character’s GameObject that the Reloadable Clip Attachment should reference:

Melee Weapons can also assign their hitbox colliders at runtime. On the Melee Weapon Properties component if no Collider is specified the Collider Object ID field will appear which will search for the Object Identifier ID.