Expose prefab variables for Dialogs/Progress in scripts or change from constants (in PrefabManager)

+1 vote
asked Apr 8, 2016 in Feature request by Cheras
Hi,

For our case, we needed to modify the colors of UI. For things that are on scene, we could do it in Editor, but for Dialogs, we have three options now:

- modify Prefabs

- duplicate Prefab, modify, rename, change PrefabManager

- just after  DialogManager.Show* update elements by hand on new object (ugh)

Both option 1 and 2 (and 3 is just too.much.pain. to maintain) requires changes to plugin, which is overwritten on plugin update.

From what I see, simplest solution would be to allow changing constants in PrefabManager or pass prefab path/object as a param.

What do you think?

1 Answer

+1 vote
answered Apr 8, 2016 by admin (31,720 points)
Hello,

Well right now as you said these are the 3 options.
Personally I would go with the last option, as using the DialogManager create the default types of dialogs with the look and feel of the Material Design guidelines.
If you want to modify things, yes, you should first call Create, then do your modifications, and finally call show...

You could easily create a static util class that will apply all sort of modifications to your dialogs so you could just do DialogUtil.SetParams(myDialog, firstColor, secondColor etc...)

Another solution: You could duplicate the prefab dialogs you want, modify them to your need and use them... But if we make some modifications to the original ones in the future, you won't have them... It should be almost the same thing as changing constants in PrefabManager :)

~ Yohan
commented Apr 14, 2016 by Cheras
Hey,

I still find 3rd option a bit annoying though :)

For modifying prefabs, that's option no.1 but the difference with option number 2 is that it's much easier (for no.2) to see it in your VCS, plus you can comment it in code saying that line has to be preserved when updating plugin, so later you can run diff between updated plugin and old plugin to see your own changes vs in modified prefab scenario diff i will be one big mess :)
commented Apr 27, 2016 by Hivemind
I'd like to add to this, as I am looking for ways of managing color themes without having to change prefab/instance settings in the editor (as it is cumbersome with complex game projects). Currently I am writing wrapper classes and other workarounds just to have some sort of consistent and global control over the look and feel of my UI, so I can keep up to date with new releases. It's not ideal and doesn't adequately cover all scenarios.

What I'd like to see (a request for the future?) is some sort of Style manager approach where we can set styles for components, and assign those styles specifically to components/prefabs (via a SetStyle method), and that styles are inherited from parent components (a little like CSS...).
commented May 2, 2016 by admin (31,720 points)
We are certainly planning on adding a theming system for MaterialUI that would allow global theming of everything in a scene or app, and per-object theming that overrides the global settings. Not sure when this will be added in though, sorry.

~ Declan.
Welcome to MaterialUI support! Ask us anything :)
...