Say I have a boolean UPROPERTY called MyBool. I want it so that when this is ticked true in the editor (details panel of my custom actor), a function will run to set some misc members of that actor.
PostEditChangeProperty() seems to be what I want, but I don’t get how to grab the value of the actual boolean. Here’s what I have so far:
/* If MyBool belongs to the ASomeActor */
void ASomeActor::PostEditChangeProperty(struct FPropertyChangedEvent& e)
{
Super::PostEditChangeProperty(e);
FName PropertyName = (e.Property != NULL) ? e.Property->GetFName() : NAME_None;
if (PropertyName == GET_MEMBER_NAME_CHECKED(ASomeActor, MyBool)) {
/* Because you are inside the class, you should see the value already changed */
if (MyBool) doThings(); // This is how you access MyBool.
else undoThings();
/* if you want to use bool property */
UBoolProperty* prop = static_cast<UBoolProperty*>(e.Property);
if (prop->GetPropertyValue())
dothings()
else
undothings()
}
}