Download

Getting data from a struct of structs?

Hey, I have a struct with this data:

Struct LevelsSetup:
Name: DataType:
Level0 LevelData
Level1 LevelData
Level2 LevelData

Struct LevelData:
LevelType LevelTypeEnum
CorrectTiles Int

So it’s a struct of a struct. I want to create a function that takes a variable CurrentLevel and then breaks out the data for that level (e.g LevelSetup->LevelData->CorrectTile), but I’m stumbling a bit.

I was thinking I’d be able to do a ‘Select’ on the LevelsSetup struct to get Level0’s LevelData but it only gives me option0 and option1. ‘Set Array Elem’ doesn’t seem to help either, was thinking I might be able to set a certain index of the LevelsSetup into a target LevelData array but no luck.

Does anyone know how to do this? I could break LevelsSetup and then break LevelData and do a massive case: situation but that seems silly.

Thanks in advance.

The easiest way to do it is to SetMembersInStruct:

c9f207f511bc52a950414e997aa729fde5ab7f67.png

Select any SetMembersInStruct node and expose embedded members. I hope I understood you right; somehow I feel I did not.

When it comes to Select node, you can add new pins by RMB–>Add pin.

Thanks, I don’t think that would work… here’s an image of what I’m trying to do (my description of data in my first post was a bit off). Imagine I can get an index of the first struct that’ll output structX… hope I make more sense now. :slight_smile:

3b58b12468a4c28a66dd55d7c5884f215c2c0b4b.png

In that case, you could use either an array of level structs or a select node:

structs.PNG

Aah, I had it in front of me all the time haha… great, thanks a bunch!