+ 1

Pick-up script

I need to make a script that enables a character to pick something up off the ground then for it to stay with them on the click of a button.

14th Dec 2017, 11:19 PM
oliver hale
oliver hale - avatar
2 Answers
0
Assuming you've built a proper class hierarchy for your gameobjects, you can create an array with your Item parent class as the elements. This will act as your characters inventory. Then use the Unity Engines built-in OnClick() method to have the item removed from the environment and placed in your inventory. Not sure if you've been to the Unity forums yet, but they're a great resource for answers to questions like yours.
15th Dec 2017, 12:50 AM
Jonathan Lee
Jonathan Lee - avatar
0
https://youtu.be/9tePzyL6dgc This should help a bit. There several videos about item pickup in this video series.
30th Jun 2018, 11:10 PM
Knight Foster Steele
Knight Foster Steele - avatar