#Selecting references

1 messages · Page 1 of 1 (latest)

graceful dome
#

@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

tacit haven
#

Again:

  • Use a CLASS variable, not REFERENCE.
  • Create the Widget runtime via the CLASS.
graceful dome
#

But how to give designer option to select different questions for different gates then?

hidden creek
graceful dome
#

yesd

hidden creek
graceful dome
#

not really, size and image backgroudn as well

tacit haven
#

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.

hidden creek
# graceful dome not really, size and image backgroudn as well

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.

graceful dome
#

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

tacit haven
#

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.

hidden creek
graceful dome
tacit haven
# graceful dome and in widgets per assets it was easy

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.

graceful dome
#

Yeah it is good point, thats why I made this parent in every widget but its still kinda workaaround