Is it possible to set the config property flag of a class at editor runtime?

I want unreal to read config variables for UAnimMontage::BlendIn without modifying the editor. This class has the config property set, but it’s not set on this particular UParameter. I’ve tried:

void SetConfigPropertyFlag(UClass* cls, const FName PropertyName)
{
	if (cls) 
	{
		UProperty* Property = cls->FindPropertyByName(PropertyName);
		if (Property)
		{			
			Property->SetPropertyFlags(EPropertyFlags::CPF_Config);
		}
	}
}

...

SetConfigPropertyFlag(UAnimMontage::StaticClass(), TEXT("BlendIn"));
UAnimMontage* DefaultObj = Cast<UAnimMontage>(UAnimMontage::StaticClass()->GetDefaultObject());
DefaultObj->ReloadConfig();

But ReloadConfig never gets past the check Class->HasAnyClassFlags(EClassFlags::CLASS_Config);
Is there some call to notify unreal that I’ve edited a property flag? Or can property flags only be changed before the property is bound to the UObject?

What are you trying to do? Maybe there better way to do it then doing reflection system hacks

I want to change the default value of UAnimMontage::BlendIn. I’d prefer to use the config system, because directly overriding it may be confusing in the future / break the existing config system.

By directly overriding the value, I mean bypassing the config system and setting the default value of the parameter directly. Likely by editing the CDO.

But this is getting off into the weeds. I want to know how to set the config flag on a parameter so that I can reload the config and have unreal read a new default value for a parameter that was not previously configurable.

what do you mean by “directly overriding it”? And why you attempting this?

I asking questions to give best solution possibly some alternative doe something looks like standing upside down method just to do something while there might be better method.

Keep in mind by doing this you exposing this varable even on runtime for all users to set, maybe not with variable you used as example but with some other it might introduce needless holes in your application.

…but I figure out what cause anyway. Class you using need to have this flag set too UAnimInstance don’t have Config specifier set to begin with

you also need to set ClassConfigName property in UClass to assing class to specific config file

Other option i was thinking out is manually reading config file with GConfig (FConfigCacheIni | Unreal Engine Documentation) and manually modify CDO, this potentially allows to patch out holes i mentioned in comment

Thank you, I understand that. In this case, I had already run through a lot of alternatives myself, before looking specifically at this solution.

I was looking at UAnimMontage not UAnimInstance. UAnimMontage has the class config set.

https://github.com/EpicGames/UnrealEngine/blob/6c20d9831a968ad3cb156442bebb41a883e62152/Engine/Source/Runtime/Engine/Classes/Animation/AnimMontage.h#L544

I had considered reading GConfig manually and setting the CDO myself. The biggest problem with this is that setting the CDO values doesn’t lead to the correct behavior. It changes the default, but new AnimMontages aren’t spawned with the default values. Instead they show those values as “modified”, but they retain the original defaults on creation.

Actually, it looks like the variable I want on UAnimMontage is a struct (BlendIn), and the specific variable I want to modify on that (time) is private. So I’m going to have to set the CDO myself. The good news is now that I’m accessing this parameter correctly, modifying the CDO is showing the correct behavior.