FIntRect not recognized as a UProperty

Example compilation error:

Unrecognized type 'FIntRect' - type must be a UCLASS, USTRUCT or UENUM

Is this a bug or should we create our own custom rect types?

FIntPoint compiles without problem as does FVector2D, etc…

I’m trying to declare an FIntRect variable as a UProperty, the compiler then throws that error. If I wrap my own UStruct or any of the other standard types (e.g. FVector etc) it accepts it.

Hey getnamo-

Where are you getting this error? Can you provide more information about what you’re doing that is causing this? Let me know if there is anything you can add that will help understand exactly what the issue is.

Cheers

Is there a rect-like e.g. (x,y,width,height) or (min,max) that is UProperty ready or should I UStruct my own for that type of data?

Just trying to follow best practices!

The FIntRect structure is not declared as a UStruct which is why you are getting a compile error when you try to declare your variable as a UPROPERTY. If you are using a source version of the engine you can change it to a UStruct inside the Source/Runtime/Core/Public/Math/IntRect.h file. If you’re using the Binary version of the engine from the Launcher then you will have to rely on using the variable in code rather than exposing it to the editor.

Cheers

I would recommend trying to stay away from overruling engine code where possible, especially since upgrades to new versions are terrible then. As far as i know there is no blueprint exposed rect-like type. Therefore i would advise to just create a custom UStruct which has the properties you want.

That’s the route I went with in the end, it was simply surprising the struct wasn’t exposed as a UStruct, it’s a minor thing though.

Might be a year and half late because I ran into the same thing today. But after a few gimmicks I decided to use FVector4 instead.