Sorry for the vague title I’m not sure what to call it LOL
I have a planet blueprint (space game) and for each planet I want to have a list of possible elements that can be mined / gathered from it
I created a struct with “ElementName”, “ElementPicture”, “ElementDescription” as that’s where I want to start - but now I need to load in the 30-40 elements that I want to have possibly available and I’m not sure where to stick the variable for the element struct array - do I put it in the planet blueprint? but then later on when I am managing my elements for my player I don’t want to reference the planet anymore, and I don’t want to duplicate my efforts (or the long list)!
I don’t want to put it in the level blueprint because I will have several maps / levels
Do I save it to the disk in XML or something and load it into the level each time or something?
There are multiple solutions to this and you’ll just have to make an executive decision
I would suggest GameState or similar, they are persistent between levels and never go away. It’s easy to reference from any BP (get GameState - cast to (your particular GameStateBP) and then you can reference it (maybe make the array public or create Get/Set functions)
If the data in question is PERMANENT (i.e. not procedurally generated at runtime, but constant for the game) an even easier way is a DataTable… Which is basically just a hardcoded array of structs which can be called easily from any Blueprint.
To reference an image (texture) you need to have syntax such as this in your .csv file as well as making sure in the structure you have it set to texture.
Texture2D'/Game/Textures/Icons/AmazingIcon'
You can store just about all variable types in data tables. Its just knowing the syntax for the .csv