Hello,
I have a small question about the best practices to implement something from my scriptable object that’s holding the relevant data to the UI that shows everything.
Imagine a small menu where you can update a few things of your Monster, Health, Damage, Attackspeed, Range, …
What I thought to do is:
- Create a SO for each existing upgrade that contains all the necessary information from the name to some parameters for the cost calculation
- Create an UI prefab how one Upgrade should look like (Small reactangle, with some name, an image, a small description, a button for the upgrade itself, …)
- Create some UpgradeComponents Script that holds a list of objects of the Upgrade-SOs and has an Init() method that initiates one of the UI prefabs for each assigned Upgrade-SO and put’s it under some parent-UI with a vertical-layout-component.
What I really like on that approach is, that I can later just create, update or delete an Upgrade-SO and done. Every change is taken over in the UI automatically. Nothing to do.
What i really hate is, that you always see this incomplete state of your UI in the Unity-editor as everything is auto generated during runtime.
So alternatively I could just do the whole UI and afterwards assign there my SOs one by one for each UI element or even completely trash the SOs and put the values directly on the corresponding UI element. Then the UI looks always nice like it would be in the game later, but apart from that I am losing the the seperation of the data from the implementation.
So what’s Unitys best practice to handle problems like that.