EditDefaultOnly vs. EditAnywhere

I know the subject has been mentioned in previous videos… but it occurs to me that the rational @Ben uses for using

 UPROPERTY(EditDefaultOnly...) 

is in the interest of “fairness”… the AI Tanks should behave the same as the player tanks, and they should all behave the same…
But… this leaves out the idea of scaling difficulty, (and conveying some realism in design)…
I may want to have a situation where as I go from level to level, the tanks slowly get more powerful… (and perhaps I “level up” as well). Perhaps you want a situation where most of the tanks on the level are fairly slow, and don’t shoot as often, but one of them is piloted by the game’s version of Darth Vader, and moves faster, shoots more often or accurately (or with more launch speed).
If we set these as EditDefaultsOnly, then it seems like it doesn’t leave a lot of room for adjustment and individual tweaking of tanks in a scene… Yes, I believe I could create a new BluePrint for my “Darth Vader” tank based on the original tank (actually, for a boss, I probably WOULD do just that), but for the variation, my preference is to leave things like the speed, firing rate, etc) adjustable.
Actually, it does pose a question, though… in Unity, there’s a way to restrict range in a public variable within the editor RangeAttribute(min, max)… is there a similar mechanism in UProperty?

Wow… took me 12 seconds of searching to answer my own question…

UPROPERTY(EditAnywhere, Category="Setup", meta=(ClampMin="1000.0", ClampMax="10000.0"))
float AcceptanceRange;

would clamp the Acceptance range between 1000.0f and 10000f…

There’s also UIMin/Max for the set the editors slider’s Min and Max.
i.e.

UPROPERTY(EditAnywhere, Category="Setup", meta=(ClampMin = UIMin="1000.0", UIMin="1000.0", ClampMax = "10000.0", UIMax="10000.0"))
float AcceptanceRange;

It looks like (from what I’ve been able to glean on Unreal Forums) like UIMin clamps the sliders, but you could type in a value out of range, where ClampMin won’t let you type in a value out of range. (I haven’t tried UIMin yet, but I do know when I used ClampMin and typed in 150, it changed it to 1000.). I’ll test that behavior when I get home later.

Privacy & Terms