Download

How do Blueprint Structures actually work?

Hi everyone!

I’m currently researching for my next book and I’m a little confused on how user created Structures work in Blueprints. I watched the Inventory series on Youtube from Epic but it didn’t help me to understand them at all.

So how does they actually work? Do they allow you to set information in one BP and pull the data in another or is it something completely different?

I tried searching up on the documentation but it seems that the Blueprint structures (UserDefinedStruct) hasn’t been written about it.

An idiot’s guide to them would really help for this research / Learning what they do!

Thanks in advance, yall!

You can treat a struct as a collection of variables bunched together. Nothing really stops one from making a struct of structs.
They help with organisation a lot.

struct.PNG

When you add a new variable to the blueprint, you can make it of ‘struct’ type.

struct2.PNG

If you have some C++ background, a struct is very similar to a class, bar the default privacy of the variables. I would even go further and call UE4’s Blueprint a fully blown struct with bells & whistles.
I hope I understood your question right.

That’s an excellent answer! Thanks!

But is it possible to store values in Structs and pass them to a different Blueprint? Such as setting an Int to 1 via the struct in one BP and getting this result in a totally different Blueprint (Without having to cast?)

You can set default values of a struct:

str def.PNG

Any object containing this structure will have a copy of the data.

You can pass a struct from one object/function to another, just like any other data type:

struct4.PNG

This includes passing as a reference.

Structs cannot be really used as an interface between blueprints since they are just a collection of data in a blueprint (which you may need to cast).
You can, however, use them in direct blueprint communication. [edit] - to easily move a large amount of different variables from one place to another.

Have you ever used Vector 2D?

vec2d.png

It’s just a struct with two floats.