I’m using Blueprints, and I cant seem to figure out how to do this.
I’ve looked on Google and every answer I’ve found I haven’t been able to follow.
I’ve got numerous ‘gems’ hidden and scattered throughout my level, with a UMG HUD displaying the total number of gems that I have. I’d like a certain button in my level to only be accessible when, say, 20 gems are collected.
Hm, no. I want to be able to press a button only when I have a certain amount of collected items. So if I tried to press the button with none, nothing would happen. When I’ve collected the set amount, the button becomes functional.
So, the set amount is a variable, right? Simply use a branch in your button function, use the gem amount variable as condition, so the button function is true when gem amount ==20
Or do I miss something because it’s very basic
You should start learning basics, there’s a lot of beginers tutorial on youtube.
Can you post a screenshot of your hud blueprint and the blueprint where you have the function of collected gems if it’s not in the same blueprint? If you can get how many gems you’ve collected, you already have this variable somewhere.
A button in the UI wasn’t quite what I was going for. However, with the blueprint you provided I was able to implement that into an in-game button. With a few tweaks. And it works great.
“A button in the UI wasn’t quite what I was going for”.
You ask for a “Button Only Press When a Certain Number of Objects are Collected”. Do you mean a gamepad button? If so, go to your controller blueprint and paste the same logic that Mookiez posted after your gamepad button event. Then, the button will react only when the condition is equal to 20