Hello. I read your reply to your other thread but before you edited it so I thought everything was somewhat solved, but as I checked it again now, that appear to maybe not be the case. Do you want me to reply to that thread still, if there is something still unresolved?
As for this topic, I need to make sure I understand how you have things set up.
You say “my dialog is all saved in these little hud designer widget blueprint files.”
Do you mean in text variables or something like…
… where textblocks are holding the text you wish to display. And maybe there’s one widget blueprint for each ‘dialogue’?
The way you can store the widget blueprints in arrays depends on what you need to do.
For example, if you only need to add to viewport or remove from parent, then I see no immediate issue. However, if you need some information from the widget, there may be some slight problem. The reason for that is, the array can only hold one class type. (Though one could go around that by using structs but I don’t think that’s relevant in this case).
So if you only want to use the add to viewport function of the widget, then that function is part of the User Widget class (or probably the widget class to be precise but I’m not sure), so we can make an array of type User Widget Class.
But if you need information from the widget blueprint, a variable created in the child class, then if the array is of type User Widget Class, that is not holding that variable, the child is. You could Cast To, as we often do with “get player character, cast to myplayerdudeclass”. But if you have many of these children (sounds like you have thousands?) that you need information from, then casting to the correct one would be a big mess. You would have to create a parent class that holds the information you need and set its information from the children.
So, if you don’t need to get information from the widget blueprints, then just make a variable, type User Widget, then click the array mark.
So, that’s how you can make an array that holds User Widgets. Now, another question is; do you need references or classes. And that brings us to the next part I’m a bit confused about.
“LINK UP all the components and references into the array”.
I’m not sure what you mean by this.
Do you just want to get, say, Widget Blueprint Class #73, create it and add it to viewport? Then you need a class, not a reference.
When creating a variable you can choose between reference and class and some other things. The default is to create a reference.
The reference points to something that is ‘created’. You can see a dropdown list where you can select instances, though there probably are not any in our case.
Class however, holds a class. The blueprints we create are actually classes and we can select the class we need, you can see some of my Widget Blueprints that inherit from the User Widget class.
As for describing exactly how you should go about doing all this… I don’t know.
-I guess the way you create the arrays is to, in the details of the array click the Add Element button (+) for each widget blueprint you wish to have in that array, in their exact order. Or
-In the construction graph or on begin play in the event graph, set the array and use the Make Array node. Then add a pin for each widget blueprint, in exact order.
It may be a lot of work setting the classes of the array(s) but it has to be done somewhere.
Another question is, where do you add these arrays? I can’t answer that. I would do it in either the player character class, some kind of instructor actor placed in the level, or the player controller. Or maybe a struct. Or a data table.
Just consider how you want to handle the array. For instance, if you create it in the droid class and it selects “good day”. Then maybe you don’t want it to say “good day” again, so you delete it from the array. But then, the next droid class might say that because it’s another instance. I guess you could work around that by “updating” all the other relevant classes with instruction “remove index x”. Or create the array(s) in a separate actor, that all relevant classes references when it comes to the dialogue. I don’t know how the arrays would look so it’s difficult to give recommendations, I can only suggest things.