[Suggest] UPROPERTY of typedef

#ifndef FPX_SINGLE_PRECISION
typedef double FPXScalar;
#define FPX_LOOSE_EPSILON 1E-4
#define FPX_EPSILON 1E-8
#define FPX_TIGHT_EPSILON 1E-12
#else
typedef float FPXScalar;
#define FPX_LOOSE_EPSILON 1E-2
#define FPX_EPSILON 1E-4
#define FPX_TIGHT_EPSILON 1E-6
#endif

I’m using typedef for floating-point type for handling precision.
but UBT cannot understand FPXScalar for UPROPERTY().

UPROPERTY()
FPXScalar mScalar;

error : In (MyUObjectClass): Unrecognized type ‘FPXScalar’

I think, it’s illogical.

Hi ,

I apologize for the delayed response. I was doing some research on your question to get the best answer I could for you.

The problem here is that the UHT is only able to recognize types that it already knows about, so when it tries to parse the typedef it will fail. The compiler will still accept the typdef though, so you can still use it in your code. Unfortunately you will not be able to use it in any form that the UHT touches, so you can’t use it with UPROPERTY, as a UObject base class, as a UFUNCTION parameter, etc. The UHT is fundamentally unable to understand the typedef so it will always fail.