Picking Up Items

How to set up item pick up.

Item Drop Prefabs

You can find both the 2D and 3D prefabs in the Assets/StylishEsper/Inventool/DefaultItemDrops folder. It's not recommended to move these out of the folder or modify them. If you'd like to change their location, name, and look, create a copy of them and modify those. See Custom Item Drops.

Also see Item Drop.

Pick Up Setup

Item pick up requires 3 steps:

  1. Ensuring Inventool knows where the player is. There are 2 ways to achieve this:

    1. Through the Initializer component.

    2. Through scripting: Inventool.playerTransform = myPlayerTransform

    Also, ensure the player can detect collisions.

  2. Detecting when the player is in range of an item drop. The dropped items handle this automatically as long as the Custom Prefab Rules were followed, which the default item drop prefabs do.

  3. Calling Inventool.Inventory.PickUpAllItemsInRange() when your specific pick up input button is pressed. This will add the items to the inventory and remove the item drops from the game world.

Last updated