Shammah
(Shammah)
August 22, 2014, 8:46pm
1
I am declaring a struct as following:
#pragma once
#include "Math/Interval.h"
#include "ChargeSettings.generated.h"
USTRUCT()
struct FChargeSettings
{
GENERATED_USTRUCT_BODY()
FChargeSettings();
UPROPERTY(EditAnywhere, Category = "Charge")
FInterval Power;
}
This gives me the following error:
Error: In TemporaryUHTHeader_ChargeSettings: Unrecognized type 'FInterval'
I’m not sure why? FInterval is even defined in the Core module, which is used inside my Build.cs.
Shammah
(Shammah)
August 27, 2014, 1:23pm
2
It turned out, that FInterval is not a USTRUCT, and therefore cannot be a UPROPERTY. The only alternative two a Min/Max kind of tuple is FVector2D, but that’s a bit overkill. I ended up storing my min and max values as separate values, as I did not feel the need to create a new USTRUCT for this.
In UE 4.14+ You can use Interval data type that shows in inspectors.
#include "Interval.h"
...
UPROPERTY(EditAnywhere, BlueprintReadWrite, AssetRegistrySearchable, Category = "MyCategory", meta = (Tooltip = "My lnteger Range."))
FInt32Interval MyRange;
...
Then in initialization you can construct your range like this:
MyRange = FInt32Interval();
MyRange.Min = 2;
MyRange.Max = 10;
Same stuff should work for float as well. Look into source for more info. UE4 documentation is the weakest point of this engine…