I am designing a UI which has a few components, such as a selection grid, that are compositions of existing Unity GUI components.
Taking the selection grid for instance, the component should be reusable and be able to be placed into any other GUILayout, where it will fit itself in automatically.
It is easy enough to make non-monobehaviour classes with a Render call that draw themselves into some GUI script, however, the trouble with this approach is that the GUI Components want to be customizable via the inspector, ie, color changes and skins.
For this to be possible the components have to exist as monobehaviour scripts but each of them having their own OnGUI rendering kills the modularity.
What is the best practice to get around this problem?
The only way I can think of is to make monobehaviour scripts with no OnGUI functions, but with a render function, then attaching those scripts along with whatever is doing the main GUI layout so it can grab instances of the other scripts and call their render. Is this the way to go?