Can I use GameplayTags to identify four instances of the same class?

Hi!

In one of my levels, I have four actors acting as door switches. The player must activate all of them to open a door.

To activate a door switch the player has to overlap with the door switch and then press the E key. I need to know on which door switch is the player to active it, but to avoid adding dependencies between the player and the door switch, I’m using events.

At this moment, I’m using a hard coded string to identify each door switch. Instead of this string, is it better to use GameplayTags?

Thank you!

1 Like

So the switch talks to the door? Just use an interface to let the switch do that. You can use an actor reference ( so it’s all modular ), and set it in the level :slight_smile:

Thank you for your answer, but my question is about GameplayTags. I’m trying to avoid hard coded strings, and I think using GameplayTags instead.

But I don’t know if GameplayTags are designed for that.

Thanks!

1 Like

There’s no hardcoded strings.

GTs are a way of categorizing things more:

Potion can be poison or healing, and the poison can be deadly or just dangerous. That kind of ‘tree’ system of tags…

I have set FOUR door switches in the level, each of them with a hard coded string. I think you need to re-read my question carefully.

I’m trying not to use hard coded strings using GameplayTags instead. But I don’t know if GameplayTags are designed for that <= this is my question.

1 Like

if you mean should you ID swtiches by GameplayTag i’d say no. Tags are good for generic things, ie Interactable.Switch if you want to ID i assume you mean Interactable.Switch.1 etc which doesnt scale well.

do you even need to ID the switches, can you just have an int on the door and when it reaches 4 it opens?

also i know you said you dont want to hardcode but if its ‘instanced’ ie in the level there is no reason not to, each instance of door can link its own switches

1 Like

You do not need tags for this, I have read your question. Use actor references :slight_smile: The switch just needs an actor reference to the door.