How to check if struct is empty?

So I know for Blueprint Objects we’ve got the isValid function, but for a struct this function doesn’t exist. How do I check if a struct is empty?

I’m not sure I get this. I mean if the reference is valid, then you have assigned a struct?

“How do I check if a struct is empty?”

I know this might be a little bit late for an answer but I stumbled upon exact this situation.

I just realized that the difference between a common BP Object and a Struct is that a Struct is set initialy by default and does not have any “emptieness” like when you check for “none”… which means that as soon as you create a variable out of a Struct in your BP is automatically creates all the variables when you created that Struct - Remember when you defined new variables for the Struct to hold, those variables also have default values that you can adjust and are set as soon as the Struct is created as a variable in your BP.

I was searching for functions like “destroy” a struct or “reset” on my Structs but the number of functions a Struct brings with it are realy drown out.

In C++, you can create a check function inside the struct

or just put an IsValid? bool in the struct that defaults to false

Expect you created a pointer to FStruct, otherwise, you cant use IsVaild on FStruct, IsValid only works on UCLASS

thats why i said create your own, lets call it something else for clarity, inside your struct create a bool called bIsStructSet with its default to false

2 Likes

I need this too and i m not a veteran of cpp how do u do what u suggest ?

no c++ required,
create any struct,
add a Bool bIsStructSet which defaults to false
whenever you set the struct set it to true.

keep in mind structs are never empty they just have the default values