I don’t think there simple way to do it, all i can think of is change flags of UProperty on runtime and you would need to do this early as possible to make it work, you might try to do this in class constructor which will be called of CDO creation (as well as you spawn it), but im not sure if property data is load up at that point. If not you would need to find different event,
So first get UClass* of class via GetClass()
or AMySpecificActor::StaticClass()
From that UClass* do FindPropertyByName(FName("FloatValue"));
to get UProperty* of property
And in UProperty you can edit flags wit those functions:
https://api.unrealengine.com/INT/API/Runtime/CoreUObject/UObject/UProperty/ClearPropertyFlags/index.html
https://api.unrealengine.com/INT/API/Runtime/CoreUObject/UObject/UProperty/SetPropertyFlags/index.html
And list of flags you will find here:
So you should call ClearPropertyFlags(CPF_Edit);
and optionally set SetPropertyFlags(CPF_BlueprintVisible) to make it just visible (atleats i think this is the flag for that, never played with them much)
I also checked, in engine you can find code that does the same thing so i guess it might be ok to do this way:
https://github.com/EpicGames/UnrealEngine/blob/7d9919ac7bfd80b7483012eab342cb427d60e8c9/Engine/Source/Developer/Windows/LiveCoding/Private/LiveCodingSettings.cpp
I recommend to this inside:
#if WITH_EDITOR
//code here
#endif
So this code only compile in editor builds, just to make sure the game will package and run as things may not be the same without editor code.
Other hack i can think of (figured mid way of writing this and may be less invasive ;p) is use:
UPROPERTY()
bool bCanEditFloatValue;
UPROPERTY(EditAnywhere, meta(EditCondition=bCanEditFloatValue))
float FloatValue = 0.0f;
I nto sure if this gonna work without bCanEditFloatValue exposed, but set bCanEditFloatValue to false on constructor and since bCanEditFloatValue this should make FloatValue permanently disabled (atleast in property editor)