Probably the best analogy to describe what I mean is Material instances. So, after I created a material I can right click on it and create its instance, where I can change any values and textures.
I’m looking for something similar, for a method where I could create a Master widget with it’s own behaviour, like animations, and create instances of it which I could fill with different data from different sources.
As an example, I’m working on UI of 2 similar screens for my game, on one of them I choose a level to play and a vehicle on another. The idea is to reuse the same UI component (card).
I created the Level card the way that on a Pre-construct event it’s variables are populated with data from data table, then, it’s children are added in a scroll box and their amount depends on the amount of rows in that data table.
I want to do the same with the vehicle cards as well, which will pull data from another data table with different data structure (forgot to mention that the image on the card is not the only data I fill it with, it has a lot more which renders outside the card in its parent widget, like Level name, time records, level to open etc., and for vehicles there should be stats like speed, handling…):
The simple way is to duplicate the level card and rewrite its pre-construct logic, but that doesn’t seem scalable at all, for instance, in the future I would like to change the card layout or its animations and I have to do it twice or even more times for each card
I hope I described it well and will be grateful for any suggestions. Thank you!