I’m trying to filter out actors from my TArray based on their GameplayTag.
Actors don’t implement the GameplayTag interface on their own so I’m casting them to my BaseGameplayTagActor which just adds this feature to an Actor. My classes derive from this to be able to use GameplayTags.
Results in: error C3481: ‘itemTag’: lambda capture variable not found
One way I managed to get it working was the following:
Struct is the same but added the variable: FGameplayTag itemTagToProcess
Created an instance of the struct, set the itemTag and only then used it.
The itemTag variable has to be defined somewhere above. It has not been present in your initial example code, so I left it out. Obviously the closure call can’t guess the tag you want to filter for