Converting a Structure with multiple String Arrays into one unique String Array.

Hey!

I have a structure with 20 String Arrays - Each Having 5 index’s - 1 Question + 4 Answers, as shown above:

I would like to gather these arrays into maybe one single array, so that I could use a switch in order to select which question I would like to set up by a trigger later.

Here’s how I have it working right now:

Simple, but very straightforward way to set up the text, although It would be awesome to not have 1 custom event for every single question.

Instead a switch would be my ideal solution for this.

Does anyone know how can I implement a swicth in here?

Thank you for your attention!

Add an integer parameter to your function.
Use a generic “select” node instead of switch.
Plug all your arrays into matching select inputs.



I would highly recommend revisiting your data structure.

It looks like all questions follow the same format : one question string and four answer strings. Instead of using a string array, you should probably make a custom structure with 1 string field for the question, and either 4 string fields for answer or an array of answers.

image

Then instead of making a struct with 20 arrays of strings, simply use an array of your new struct type. The whole thing should become much clearer to manage and use.

image

2 Likes

This. I’d start putting the whole thing in a Data Table.

You can then fetch it by RowName. It’s also easier to edit a spreadsheet outside of the UE environment.

1 Like

Hey! @Chatouille and @Everynone!

Thank you for your input! These are amazing suggestions!

For now, I will implement this option, for the sake of time and because it works perfectly with the current setup:


I will implement this option in a future version, where the questions have to be edited outside Unreal for a more convenient setup.

Thank you guys for your help! This is incredible helpful!

Wish you the best!!

1 Like