Download

How can I access UProperties within a struct?

Hi,

I’m trying to access a variable within a struct which is located within a class.

  • I get an object of that class as a function argument.
  • The Property containing the struct is BlueprintReadOnly. I save it into a blueprint variable.
  • But I can’t access the Structs properties.

This is what they look like:


MyStruct{
GENERATED_USTRUCT_BODY()
...
UPROPERTY(BlueprintReadOnly, Category = "MyVars") 	float TransitionPosition; 

}

Any idea why the same thing worked for the UProperty within the object, but not for the one within the Struct?
Thanks!

My guess would be that your USTRUCT doesn’t have the BlueprintType keyword.

Unfortunately, it has :frowning:

Or maybe I don’t search for them in the right place?
When I do a context sensitive search for actions related to the object, I can find the accessible properties under variables->mycategory.
When I do the same for the struct variable, there’s almost nothing.
It lists only Promote to Variable, Make Literal Tag…, Set MyVar, Break…

Or do I need to get them manually? Am I missing something?

Blueprints don’t have nodes to get and set individual elements of structs, just the make and break nodes.

Ah I almost thought I was just too stupid.
It works. Thanks!