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/Inventool/Resources/Inventool/ItemDrops
folder. It's not recommended to move these out of the folder. If you'd like them to be in a more convenient location, create a copy of them and move the copy to your preferred location.
Also see Item Drop.
Pick Up Setup
Item pick up requires 3 steps:
Ensuring Inventool knows where the player is. There are 2 ways to achieve this:
Through the Initializer component.
Through scripting:
Inventool.playerTransform = myPlayerTransform
Also, ensure the player can detect collisions.
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.
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