Deprecating UPROPERTY

Is there a way to mark a UPROPERTY with the Deprecated tag in the same way as you can with, say a UCLASS?

There is a class property flag called CPF_Deprecated that marks properties as deprecated, meaning that they will be loaded from content packages, but not saved back. The actual markup in your class declaration is a little different from marking UClasses, however.

If you take a look at HeaderParser.cpp, FHeaderParser::GetVarNameAndDim around Line 3561 you can see that the way to mark a property as deprecated is to attach “_DEPRECATED” to its name. So if you have a property FString MyString; you would rename it to FString MyString_DEPRECATED;. Of course, all usages of this variable would have to be renamed as well - the easiest way would be to use a refactoring tool, such as VAX, or you can do a Find In Files.

You can find a few example usages of this in the code base by searching for “_DEPRECATED”.

1 Like

I had seen the _DEPRECATED suffix in the code, just not gone digging far enough to see that it actually had effects on de/serialization. Are there any plans to harmonize this with the metadata tags used elsewhere, or at least allow the tags to be used as an alternative? In any event, thanks, exactly what I wanted to hear.