Hello,
I’m attempting to return a reference from an element in a TArray (an Array of USTRUCT). The intent is to then use that returned reference to modify the array value.
TArray<FCharacterAttribute> Attributes;
bool UAttributeComponent::GetCharacterAttribute(FGameplayTag tag, FCharacterAttribute& attribute)
{
for (auto& value : Attributes)
{
if (value.ParameterTag == tag)
{
attribute = value;
return true;
}
}
return false;
}
I assume this is the way to do it - but it seems to come back as a value (ie modifications dont persist in the array). Any ideas how to do this?