Radial Menu Request

  • Hey, do you mean the color of all radial menus (including the buit-in ones)? Or only colors for radial menus created by plugins (via Player.showRadialMenu())? Do you want to set a general color for the entire menu, or individual colors per entry/item? ^^

  • I could add a method to provide individual colors for each items (for plugin-created radial menus) :) However, changing built-in radial menus is a bit tricky... they're created dynamically, so it's very difficult to access them through the Internals class... the cleanest way for that would be to have an event (the event could then provide methods to modify the radial menu). It's on our to-do list, but unfortunately I have no ETA for that yet :silenced:


    But for plugin-created radial menus, it's actually already possible to modify it by overwriting the internal style of the menu. Unfortunately it's a bit cumbersome. The path to the entry is RadialMenuLayer/radialMenu/radial_X_Y_selector, while X is the amount of entries of the radial menu, and Y is the entry you want to change (first entry is 0).


    For example, if you create a radial menu with 5 entries (i.e the arrays you provide have a length of 5) and you want to change the color of the first entry, the path would be RadialMenuLayer/radialMenu/radial_5_0_selector. The last entry, for example, would be RadialMenuLayer/radialMenu/radial_5_4_selector etc. The code could look like this:


    But I will also add a parameter for that (to the Player.showRadialMenu() method), so there is no need to deal with internal styles. Probably it'll make it into the upcoming update :D

  • Hi red51

    Sorry to be a pain, but can you show an example for the MessageBoxLayer?

    I've been trying to hack it for a few hours but I think just asking you may be easier :lol::lol:


  • Sure, but it depends a bit on which message box you're using, because they have a slightly different layout ^^ Like the radial menu, they're created and attached dynamically, so you have to overwrite the style right after showing the message box to the player.


    When showing a regular message box (via Player.showMessageBox()) and you want to change the left button, for example, the path would be MessageBoxLayer/DefaultMessageBox/buttonContainer/buttonCenterContainer/buttonLeft. The code to do that could look like this:



    If you want to change the background color of the message box itself, for example, just apply the style to MessageBoxLayer/DefaultMessageBox. But keep in mind that message boxes have a background image, so instead of changing the backgroundColor, you have to change backgroundImageTintColor.


    To get the path to elements, the easiest way is usually to use the integrated UI debugger (just enter uidebugger without parameters into console). Since active message boxes prevent you from opening the console, you can enable the UI debugger first, then bring up a message box. Hover the element to see the path of it (rightclick on it to copy the path, or alternatively find the path in the top left corner) :)

  • So is it possible override the hover background colour on modal windows like the Accept_Decline one?

    No, unfortunately this isn't possible currently :/ Basically the hover style is defined in the RW .uss file... yes, USS is Unity's version of CSS (but unfortunately it lacks some CSS features). The API allows you to load custom USS files (StyleSheets), but right now you can only apply them to API-created elements...


    But we could add a method to the Internals class which enables you to apply custom StyleSheets to any UI element (this way you would be able to override the hover style of built-in elements) :)


    There is just a small, but annoying limitation: Unity doesn't allow dynamic StyleSheet creation from text, instead it needs to be imported or created in the editor. As a result, you can only load custom StyleSheets from AssetBundles atm. They said that they want to change that 3 years ago, but unfortunately that didn't happen yet...

Participate now!

Don’t have an account yet? Create a new account now and be part of our community!