What is a structure?

It contains variables. But to me it seems it doesnt really save something but only tells another array what variables it can contain?
Like for example I have in my Character Blueprint an array variable which is based on that structure, and it contains all the variables, but everything is saved in that array not the structure it self.
Or how is it?

Arrays can contain Structs, which is a way that you can make two dimensional arrays in UE4.

A structure is a group of related values stored together. For example a Point structure has three float values (X, Y and Z) and represents a location in 3-D space.

Structures can contain other structures. A Player structure might contain a Location which is a Point structure, and Inventory structure which contains data about what the player is carrying, a Health structure for the status of the players health, etc.

Structures are an important in documenting your code in that they keep related values together in a single place.

ye but the structur doesnt save things.
It’s saved in the array which uses structur, right?
otherwise it doesnt make sense to me, for me the structure just tells an array variable of what kind of variables it can consists, but it is all saved in the array not the structure, otherwise the structure would be overwritten all the timeand it would not make any sense to me

A structure is a data type.
A variable can either be of a basic type, or of a struct type.
An array is just a collection of multiple variables of the same data type.

where are the data saved?
For instance if I have 4 objects, I give each different values.
If they all save it in structure, then it would overwrite the variables each time in the structure.
So I assume it’s not saved in structure, but in each blueprint variable that connects to structure.

Can someone pls tell me where the values are saved?
Let’s say I have a sword object (blueprint actor) I give it a variable that refers to structure, and it has name, damage, etc.
And I have other weapons as well with different values. How can they all save their values in structure? That would overwrite the variables.
I know what an array is. It contains several variables.
But now some people seem to say the structure carries the information, if that was so then the structure would be overwritten all the time, and that cannot be, since several blueprint actors that uses the structure have different values. It would just make no sense.
Structure contains the variable “name” only once.
It cannot be that it is saved in Structure, since it would be overwritten all the time. A variable can contain only 1 value at a time.
Besides the values were set in each Blueprint actor (sword, stick, etc.).
I dont know how people here keep saying the structure contains all values…

And u said it urself vb4, the structure is the data type, just like any other type (float, integer, etc.)
that’s also how I understood it and only how it makes sense to me. The structure tells a variable in another blue print of what variables it can contain, the structure itself doesnt store anything. The variable that is of structure type, saves everything. Only that makes sense to me. Maybe the people here who say the structure saves it they don#t understood it.
I know a structure can also hold values, I can set value right in the structure for each variable, but that’s not what I am talking about here.

It might help to just think of Structs / Arrays-of-Structs as a table of Rows/Columns in Excel / LibreOffice.
Can help to think this way too because you may have to deal with saving out / loading the values back in.

But its about putting a structure to data here, there’s nothing magic going on, so try to not over think it.
One variable is a single Excel cell. A Struct is several rows / cols. Array of Structs is the entire data table…

For now it may help to create variables under well-grouped Categories while discovering Structs you need …

The value set in the structure definition is the default value.
You understood correctly that the structure is basically a data type blueprint. The variables that use structure types are instances of that structure blueprint.
Your array contains three instances of your struct type.

so I was right the whole time that the values are saved in the variables of the blueprints, and the structure just decides what type of variable the variables are? After all I set the values in the blueprints not the structure itself.


Yes, the custom structure that you created in your Content Browser only serves as a “prototype” of what your custom struct should contain when you create them in Blueprints.

The UE4 Vector struct would look like this:

float X;
float Y;
float Z;

It just defines what type of data the struct contains, but every Vector variable you create will have their own unique values.

ok, thank you.