accessing Gameplaytags in runtime and change its state

I have 20 different switches where the functionality of each switch only works when the states of certain other switches are changed. I am currently using gameplay tags to change the state of these switches.
The game is a VR simulation, and I already have a state machine to detect changes in state using gameplay tags. I use joystick input to set the state of the switches. For example, I have an enum:

UENUM()
enum class EVehicleEngine : uint8 { Start, On, Off };

I’ll use this enum as an example, but I want to use gameplay tags instead. Since I understand how it works with enums, I’ll illustrate using enums:

If InAxis is +1 => set the enum to 1 ( enum can be represented as an int, making it easy to set the first value in the enum).
If InAxis is +1 and the current state is enum 1 => enum 0.
If InAxis is -1 and the current state is enum 1 → enum 2.
If InAxis is -1 and the current state is enum 0 => enum 1.

Just incrementing and decrementing values depending on axis value and current state

Here, you can see that I don’t need to know the child name; I can just use the int value to change the state. I want to achieve the same using gameplay tags.

I have a state machine component that holds a tag container for the current state. I also have a switch component that can store a single tag. All I need to do is trace the button, get the button’s i am pointing to and get gameplay tag state (computed at runtime depending on the parent, so cant specify exact tag name), and change the state according to the input and other conditions.

i am bit dumb, so if there is any better approach, pls let me know

1 Like