Hi all. I want to trigger a few actions after the user has hit 3 buttons that are on screen. But I want them to be able to hit them in any order, and the action only triggers on the last hit. What is the cleanest way to achieve this? I was thinking of doing a hidden linear gauge that you add +1 to each time a button is hit and the condition is it reaching 3. I haven’t tested this or really used gauges so before I dive in I was just curious if that is a good way. Open to all suggestions. TIA!
Hi Tim @tlitostansky,
A Linear Gauge is really meant to be a visual component, not really a logic component.
With the logic you described, you could use a Simple Counter and use the "Count equals” trigger. The issue with that is you won’t be able to test if the user clicked each button 1 time or 3 times on the first button.
A better approach would be to use
- 3 Buttons: Button X, Y, Z
- 3 Toggle Buttons: When Button X is released
- Check Toggle Button X (This can happen only once, since you can’t check an already checked toggle button)
- Simulate a tap on a “Test Result” button
- 1 “Test Result” button: When released, if Toggle Button X is checked AND Toggle Button Y is checked AND Toggle Button Z is checked, then perform the action you need.
Let us know if that would answer your needs.
Seb
Thanks @Seb !
I think that worked. When I leave the scene and come back it seems to have automatically reset the toggle buttons, which is what I would want. Is that the default behavior for toggle buttons?
Thanks for the feedback Tim!
By default, every asset will be reset when you exit / come back to the scene that contains them.
If you didn’t want that behavior, you could either disable the “Reset All Asset Properties” scene property (I wouldn’t recommend that, unless you have a really good reason) or move your Toggle Buttons into an Experience layer.
If you have any other questions related to your XP, don’t hesitate to reach out via our support platform.