#Selecting references
1 messages · Page 1 of 1 (latest)
@tacit haven Ok, more context here. I want to select the very asset. Because for every gate I have different widget bluperints assets to show. I have 20 gates and every one of them is using different widget bluperint
Again:
- Use a CLASS variable, not REFERENCE.
- Create the Widget runtime via the CLASS.
But how to give designer option to select different questions for different gates then?
are you creating a new widget for each question/answer?
yesd
That's seems overkill to me. I would imagine the only difference is the text?
not really, size and image backgroudn as well
Ignoring the massive overhead of creating one Widget Asset per "question/answer", there is no real difference to what you are doing right now.
It's just that this properly creates a new Widget instance from the class instead of wrongly trying to use the Asset Object.
You should rethink your idea of using multiple widget assets tbh. If the layout of the widgets are mostly the same and only the visuals and texts are different, then having more than one Widget asset seems wrong to me.
You want this "data driven". E.g. a DataTable that is based on Struct that has all the data to shape the widget (size) and design it (background/question/answers).
And your designer should then just select the row they want to use and you feed that into the Widget so it can set itself up.
You could create a single widget where you can specify the background image and the text for the question and responses.
In the BP you would specify these and then at runtime, create the widget and pass in the variables. The widget would then update the relevant text boxes and images.
I wanted to avoid creating widget per asset but wasnt able to set it however with creating these widgets at runtime I see it now. Thank you for help guys I will try to modify this aproach
I've had problems with multiline text in bluperints
and in widgets per assets it was easy
And if, by any chance, you have a few gates that need a drastically different design so that you can't make it work with the DataTable alone, then you can still go a more complex route of having a base Widget class and having special versions as child classes that can look different, while the base class has the "InitYourselfFromData" function that the children can override.
It looks like there might be some similarites to some dialogue systems so it might be worth looking at how some of those are setup. It might give you some ideas on how else you could approach what you're trying to do.
yeah, I've made parent and later included this in every question
Imagine you create 50 Widgets for your game. Or even more. And most of what is different is the text. Now imagine you want to change something that is the same in all 50+ Widgets.
You'll freaking hate yourself for having to adjust that all one by one.
You should treat this stuff as "re-usable". Always in a way that you only have to change something in one place to affect all instances that share whatever it is.
Yeah it is good point, thats why I made this parent in every widget but its still kinda workaaround