How can I do this pick up system? I have been trying to create a system that allows the player to interact with (basically pick up except they don’t actually pick it up) an item, and when interacted with it creates a widget above their head of the item interacted with. I want to make it so that when they have a widget above their head, they can’t interact with other items until they “put the object down”. I have set up this pickup event and blueprint interface which is working correctly
I also have this in the blueprint of the object they are picking up, which will delete the object and creates the widget when the player interacts with it
Is there any way I can update this so that when the player is picking up one item, it won’t allow them to pick up another item? I have tried some ways, but they don’t work due to the fact the objects are spawned in later on, so I can’t access global variables for them in the level viewport as they are not placed in to start with.
Here it’s a user widget soft class reference. It can be some other ID but since you want to track it with widgets and we already create them anyway, we could use that.
Thank you so much for your help! It is working better now, the widgets are showing up and everything, but I’m still having the issue that the player can pick up multiple things at the same time!
Id setup a “held in hands” variable on your player class or inventory component whatever you may be using. On interact, check whether it is empty or not and pickup or not accordingly
Does it mean you can carry only 1 item at a time? Because that was not clear at all. I was under the impression you wanted to carry 1 item of each type.
It that case, may I suggest you completely discard what I suggested and simply add a single boolen variable instead. Query it when picking up an item and set it to true if successful.
Thank you very much! Seems like a simple solution so I’m embarrassed I didn’t figure it out myself, but I this is my first project using Unreal Engine and I’m relatively new to coding, so I appreciate the help