void Myclass::SetActorValue(AActor* BP, FString variable, float Value) { FFloatProperty* FoundProperty = FindFieldChecked<FFloatProperty>(BP->GetClass(), *variable); if (FoundProperty) { float VarValue = FoundProperty->GetPropertyValue_InContainer(BP); VarValue = Value; FoundProperty->SetPropertyValue_InContainer(BP,VarValue); } }
//其中 variable 为对应参数名
//Value 为参数值
//BP蓝图actor对象