![]() This is a lot of micro management, but it's worth the time as it will work with any Canvas Scaler setting. To change the bottom margin to be at 10% of the windows height, you will have to change Hex RectTransform's Min Anchor Y value to 0.1, its Max Anchor Y value to 0.15 (if you want the Hex component to be occupy 5% of the window's height) and move all other component in the same manner. For example: the bottom margin is 5% or 0.05 Min Anchor y value in Hex RectTransform. This prefab's scaling is achieved by adjusting all its components' anchors. Each row has 3 columns that also needs to be adjusted (Hex row has only 2 columns, its left margin is set in the Padding section of HorizontalLayoutGroup). To change the way it scales will have to change the minimum and prefered values in Layout Element components of Sliders, Hex, Palette and SelectedColor rows as well as Layout Groups' Padding. Its values are adjusted for 1920x1080 screen size and 100pixels per unit Canvas scaling. This prefab is built with UnityUI's Horizontal and Vertical Layout Group and Layout Element components. RRGGBBAA) will result in RRGGBBAA colorįor strings of other length or when the Escape key is pressed the value will not be set (value from before selecting the input field will be restored). ![]() RRGGBB) will result in RRGGBBFF color (alpha is 1)Įntering 8 characters (i.e. RGBA) will result in RRGGBBAA colorĮntering 6 characters (i.e. RGB) will result in RRGGBBFF color (alpha is 1)Įntering 4 characters (i.e. It works exactly as in Unit圓d:Įntering 3 characters (i.e. Hex Input.Īllows selecting color with its hexadecimal equivalent. You can do that either with the input fields or with the sliders. Red, Green, Blue and alpha controls allow you to specify each color value separately. You can select the hue value with the Hue slider and then pick the color from the palette by mouse clicking/dragging. Saturation/Brightness palette for the current Hue slider value. If you want to save their colors not only through scene changes but through multiple play sessions, youd probably have to write it to a file. Components: Selected Color:ĭisplays currently selected color and it’s alpha value. Then when the scene loads, loop through all color-able objects and check the colorMap for what color they should get and apply it. You can choose whether the alpha channel should be visible or not in the Inspector. The event is fired after a color is selected in the ColorPicker. You can access the color selected in ColorPicker with the SelectedColor property or by subscribing to the ColorUpdated event. To add it to your project, simply put the prefab of your choosing inside your UI canvas and assign it to your script. You will find more detailed description of the prefabs below. They both scale in a different way, so you may want to try both to get the best results. ![]() How to use it?ĭepending on your UI structure, you may want to use either the LayoutGroup prefab or RectTransform anchored prefab. That includes Red/Green/Blue sliders with input fields and additional Alpha channel that can be disabled in the inspector, Dropper tool, HSV palette and selecting color with its Hex value. A simple color picker with all basic tools for color selection.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |