Reorder variable Categories in Class Defaults

Five. Years.

:man_facepalming:

Has anyone tested to see if UE5 improves this?

I want my “Area” category at the top, not the bottom…

Also, I see some mention of C++ in the thread… what about Blueprint and actual UI support for this?

2 Likes

The problem has been solved!
I found this discussion because I had this problem today.
I have a base class A and a subclass B.
A have Category “Common”.
B have Category “Data”.
I want “common” to come before “Data”.
Create an unused variable in “B” and hide it.
Here’s the example.

//Common
UPROPERTY(BlueprintReadWrite,EditAnywhere,Category=“Common”,meta = ( EditCondition = “non1 != 0”,EditConditionHides))
int32 non1 = 0;//unused variable

//Data
UPROPERTY(BlueprintReadWrite,EditAnywhere,Category=“Data”)
FString DataSource;

As we all know, subclasses serialize first, so let the subclass serialize the parent tag ahead of time, and then fill it in when the parent class serializes.

Finally my English is not good, but I am trying to help others.
The discussion is over.
——————————————————————————————————————
简单来说官方可能不觉的这是一个缺陷,因为我们可以在子类里提前把父类的标签的顺序安排好,
例如
父类里有个标签 名为 common
子类里有个标签名为 Data
我在子类里这样写:

//Common
UPROPERTY(BlueprintReadWrite,EditAnywhere,Category=“Common”,meta = ( EditCondition = “non1 != 0”,EditConditionHides))
int32 non1 = 0;//unused variable

//Data
UPROPERTY(BlueprintReadWrite,EditAnywhere,Category=“Data”)
FString DataSource;

我们都知道子类会先于父类序列化,所以让子类先把父类的标签序列化一下,
让一个没有用的属性来做这件事情,并且它会将自己隐藏。
最后父类序列化时候就自动填入了。
最后我也是突发奇想产生的写法。

五年的帖子应该终结了。

1 Like

The still exists. Has existed since 2015. Also, renaming subcategories or trying to change their location sometimes just resets the whole thing, leaving me with 100 variables to re-categorize over and over again.

Would really like to see this.

EDIT: Ah, just seen it has been set as “won’t fix”… Unreal Engine Issues and Bug Tracker (UE-51770)

The problem has been resolved
Just change the categorie site
Like when you change the location of the variable

What is a category site? Can you be more specific please? I found nothing

It is convenient to set public instance variables when this is needed.

UE 5.0 gives something better :slight_smile:

There’s a UE5 way to register toggleable property sections, so users need a single click to only display the category we want to work on.
Method is described in the release notes. Tested, works beautifully.

Added the ability to break the Details view into sections, such as “Rendering” or “Physics”. Sections can be defined anywhere with access to FPropertyEditorModule, using the FindOrCreateSection function. See FDetailCustomizationsModule::RegisterSectionMappings for an example of current section mappings.

.unrealengine.com/5.0/en-US/unreal-engine-5.0-release-notes/

A few lines above there’s also mentioned an addition of PrioritizeCategories meta, but that… doesn’t actually work.

3 Likes

Again, this is a C++ only solution? Blueprint users are forgotten like so often is the case?

1 Like

Doing this via blueprint? TOO EASY we can do it with materials using priority. Why not have priority for the variable categories?

1 Like

Reordering categories is possible, if you are in C++, using the PrioritizeCategories meta-specifier inside the UCLASS macro. It accepts a space-separated list of categories.

UCLASS(Abstract, meta = (PrioritizeCategories ="Sound Content Style"))

There are some caveats I have noticed:

  • The list of categories splits on spaces, not commas. This means you can’t use categories that have spaces in them if you want to use this feature on them, even though it’s technically possible to have a category name with spaces. You can get around this by using PascalCase for your categories.
  • Some categories always come first (such as default)
  • Some categories ignore the sort order and insert themselves wherever they want. I’m assuming this is a bug, but for example, in a class derived from UCommonButtonBase, the Accessibility category always inserts itself after whatever the first category in PrioritizeCategories is. So for the example above, it always displays as Sound, Accessibility, Content, Style, rather that Sound, Content, Style, Accessibility like you’d expect.
4 Likes

There is PrioritizeCategories, which accepts a space-separated list of category names.

UCLASS(meta = (PrioritizeCategories ="Sound Content Style"))

It seems to have some bugs, but it’s better than nothing.

6 Likes

This should be marked as answer.

Looks like a very very new feature, because it’s almost not existent in engine’s code.

Big thank you for sharing!

Several categories appear above mine even when using PrioritizeCategory.

image

Same here, I have 5 categories and put them in the “PrioritizeCategory” but only 2 got prioritized, others are still at the bottom…

Ugly solution, but If you use UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "None") it will use the name of the class as a category and will sort it at the top. Note that you can’t use subcategories with None. Also if you want to search the category in the BP graph, you can search for |None.

Also a slightly “better” solution for some may be to use UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Default"), as the Default category is close to the top in instances (but at the bottom in class defaults). But with this at least you can use subcategories which will be usable in the BP graph editor.

2 Likes