Edit Blueprint Variable in C++

Hi teddi
You can use the reflection system, check I made this node for you:

bool UGenericClass::changeFloatInBlueprints(AActor* InActor, FName PropertyName, float value)
{
	UProperty* Property = InActor->GetClass()->FindPropertyByName(PropertyName);
	if (Property)
	{
		float* ptrValue = Property->ContainerPtrToValuePtr<float>(InActor);
		if (ptrValue)
		{
			*ptrValue = value;
			return true;
		}
	}
	return false;
}

is working is this way:

Summary:

As you can see you can access the UClass and later you can find a UProperty* by name, with that you can access the proper pointer and then you can change the value, this is the power from unreal reflection system

Hope this help
Cheers

1 Like