For simple bool checks like this, there’s an easier way to do it: EditCondition.
UPROPERTY(EditAnywhere, Category = "Default")
UPROPERTY(EditAnywhere, Category = "Default", meta=( EditCondition="bIsDestructible" ))
But it has to be a simple bool variable. Even a bool expression like “SomeVariable>100.0f” won’t work.
Also, when referring to members by name, there’s a useful macro in the engine to make sure that member exists: GET_MEMBER_NAME_CHECKED. If you rename the variable for whatever reason later on, any attempts to use the variable by name will fail to compile, letting you know where you need to update them.
bool MyActor::CanEditChange(const UProperty* InProperty) const
const bool ParentVal = Super::CanEditChange(InProperty);
if (InProperty->GetFName() == GET_MEMBER_NAME_CHECKED(MyActor, MaxHealth))
return ParentVal && IsDestructible;
Lastly, never ever compare by FString when you can compare by FName. FString comparisons have to compare each character in the string, but FNames use a special hashing mechanic to allow much faster comparisons.