I want a function that adds a default element to any sort of TArray.
This is my code:
bool UMyBPFunctions::ArrayByName_AddElement(UObject* Target, FName Name)
{
FProperty* property = Target->GetClass()->FindPropertyByName(Name);
FArrayProperty* Array = Cast<FArrayProperty>(property);
TArray<ArrayInnerClass>* outArray = Array->ContainerPtrToValuePtr<TArray<ArrayInnerClass>>(Target);
outArray->AddDefaulted();
return true;
}
The “ArrayInnerClass” part is pseudo-code. Thats the dynamic array-type/the part i dont know how to do.
Does anyone know how/if it is possible to do this?