Show property based on enum

Hi guys,

I would like to have an enum in my classin which the user can select a mode.
Based on this mode more properties should show up.
Do you know any way to do this.
A example is in the skeletal mesh component you can select the animation mode and based on this you can either select an animation blueprint or an animation asset. But I couldn’t figure out how to do this

You might be looking for UENUM? Using the keyword lets you define an enum type that can be displayed in any slate widget in the editor’s UI. Here is an example:

UENUM(BlueprintType)
enum class LaneSplitter : uint8
{
	None UMETA(DisplayName = "None"),
	Color UMETA(DisplayName = "Color"),
	Piles UMETA(DisplayName = "Piles"),
	Grass UMETA(DisplayName = "Grass")
};

Yeah I got an UENUM in my class and it is shown in the editor properly.
But I would like to do, is to have another property that is shown in the editor based on what the user select in the enum

For example I have an

enum Mode
{
     ModeA
     ModeB
}

and 2 properties 1 of the type A and 1 of the type B, if the user selects ModeA I want to shown him property A and let him edit it. But if he selects ModeB, property A is not shown and only property B is shown and can be edited.

Does anyone have an answer for this?

I’m yet to try this, but it seems to me that one has to utilise Details Panel Customisation.

i’m interested to

No, only property limiting build in features i know is for bools with EditCondition specifier on URPOPERTY(). Beyond that you need to do detail panel customization as Greywacke said. The animation mode is actually done that way in Skeletal Mesh component customization:

https://github.com/EpicGames/UnrealEngine/blob/f509bb2d6c62806882d9a10476f3654cf1ee0634/Engine/Source/Editor/DetailCustomizations/Private/SkeletalMeshComponentDetails.cpp#L107

Other good example is collision profile settings, as it using enums to limit access to other properties of it’s struct

https://github.com/EpicGames/UnrealEngine/blob/b70f31f6645d764bcb55829228918a6e3b571e0b/Engine/Source/Editor/DetailCustomizations/Private/CollisionProfileDetails.cpp

This is what you need: Unreal Engine UPROPERTY Edit Conditions