Pickup questions

gxchris

New member
Can anyone explain how to set up the item pickup, especially how to set up the interactor in detail? I had a simple inventory system before and my player collides with the item to pickup. Once the pickup is setup, what should I do to make the items appear in the inventory grid? Thank you!

1629984841281.png
1629984873238.png
 
The Interactable is a component that can interacted with.
The Interactor is the component that initiates the interaction.

For example normally a player character is the interactor and the pickup is the interactable.

In the screen shot above you hooked it up incorrectly. The OnInteract is an event that is fired when the object is interacted with. Right now in the above screenshot you are saying "if the object interacted with -> interact with the object" that will create an infinite loop and it will crash Unity.

To set it up properly you don't need to add anything in the "OnInteract" event. simply add an ItemPickup or InventoryComponent next to your interactable component and make sure it has a trigger collider.
On the Interactor make sure you have an Inventory next to it.

You can refere to the Demo scene to see how we've set things up.
You can check the Demo prefabs too. for example check the ItemPickup prefab:
1629987699743.png

I would also highly recommend you watch the video tutorials if you haven't yet.
 
Top