Hide And Show Variable In Property Window

hi.
for example, i have actor in scene that have many bool and float variable that showing in the Detail Panel.
by default all variable is showing in property window and i want when true First bool variable, then show second float variable.
sorry for my bad english and thanks for your help.

1 Like

Are the variables from a derived C++ class or blueprint only? I do not know if there is a fancy way to use UPROPERTY() in such a way to fit that need (probably some convoluted way does exist), but that sounds to me like you would want to change the behaviour of the editor itself, in which case you’d have to change the source code of the editor in the engine. Why would you want something like this?

all variable is from C++ code.
please select a static mesh and goto physics tab and change locked axis enum from “Default” To “X” then you see that lock axis translation and lock axis rotation showing.this is very good for level designer for easy using from my code.

Look at some documentation about the Category in UPROPERTY, you can even have sub categories within a category that you can show/hide.

i know this is really late but i answer the question just in case someone looks for something similar.
There is actually a meta data that can get set

i.e. like here - look for “bTrimmedInSourceImage”

// Origin within SourceImage, prior to atlasing
UPROPERTY(Category=Sprite, EditAnywhere, AdvancedDisplay, meta=(EditCondition="bTrimmedInSourceImage"))
FVector2D OriginInSourceImageBeforeTrimming;
    
// This texture is trimmed, consider the values above
UPROPERTY(Category=Sprite, EditAnywhere, AdvancedDisplay)
bool bTrimmedInSourceImage;

Hope that helps :slight_smile:

7 Likes

This really should be more widely known! Thank you so much!

thanks a lot. it really help me.

There were improvements related to MetaTags since this question was asked and answered.

Starting with UE4.23:

The EditCondition meta tag is no longer limited to a single boolean property. It is now evaluated using a full-fledged expression parser, meaning you can include a full C++ expression.

This means we can do things like disabling (or even hiding) a property based on the value of an enum UPROPERTY. Hiding can be achieved by using the EditConditionHides MetaTag. Example:

UENUM(BlueprintType)
enum class EInterpolationMode : uint8 { Linear, Curve };

USTRUCT(BlueprintType)
struct FBlendableInterpolationData
{
	GENERATED_BODY()

	UPROPERTY(BlueprintReadWrite, EditAnywhere)
	EInterpolationMode InterpolationMode = EInterpolationMode::Linear;

	UPROPERTY(EditAnywhere, meta = (EditCondition = "InterpolationMode == EInterpolationMode::Linear", EditConditionHides))
	float Duration;

	UPROPERTY(EditAnywhere, meta = (EditCondition = "InterpolationMode == EInterpolationMode::Curve", EditConditionHides))
	UCurveFloat* Curve;
};

WARNING: There is a special case where EditConditionHides can crash the editor for engine versions 4.26 and 4.27.

More examples for property disabling/hiding can be found here: Unreal Engine UPROPERTY Edit Conditions


In addition, if you need more complex property manipulation (hiding groups, categories, or changing a property value depending on another) you can take a look at: https://docs.unrealengine.com/latest/INT/Programming/Slate/DetailsCustomization/index.html. You can browse through the Engine code to see how they utilize this method.

2 Likes

Thanks, this really help a lot