public void ApplyColors(GameObject root) { UIStyle[] styles = root.GetComponentsInChildren <UIStyle>(true) .Union(m_prefabs.Where(p => p != null).SelectMany(p => p.GetComponentsInChildren <UIStyle>(true))).ToArray(); for (int i = 0; i < styles.Length; ++i) { UIStyle style = styles[i]; switch (style.Name) { case "PrimaryColor": style.ApplyImageColor(Colors.Primary); break; case "SecondaryColor": style.ApplyImageColor(Colors.Secondary); break; case "BorderColor": style.ApplyImageColor(Colors.Border); break; case "Border2Color": style.ApplyImageColor(Colors.Border2); break; case "Border3Color": style.ApplyImageColor(Colors.Border3); style.ApplyOutlineColor(Colors.Border3); break; case "Border4Color": style.ApplyImageColor(Colors.Border4); style.ApplyOutlineColor(Colors.Border4); break; case "AccentColor": style.ApplyImageColor(Colors.Accent); break; case "TextColor": style.ApplyTextColor(Colors.Text); style.ApplyImageColor(Colors.Text); break; case "Text2Color": style.ApplyTextColor(Colors.Text2); style.ApplyImageColor(Colors.Text2); break; case "ModalOverlayColor": style.ApplyImageColor(Colors.ModalOverlay); break; case "MainMenuBarColor": style.ApplyImageColor(Colors.MainMenuBar); break; case "MainMenuButtonColor": style.ApplyMainButtonColor(Colors.MainMenuButton.Normal, Colors.MainMenuButton.Highlight, Colors.MainMenuButton.Pressed); break; case "MenuItemColor": style.ApplyMenuItemColor(Colors.MenuItem.SelectionColor, Colors.MenuItem.TextColor, Colors.MenuItem.DisabledSelectionColor, Colors.MenuItem.DisabledTextColor); break; case "ToolsToggleColor": style.ApplyImageColor(Colors.ToolsToggle); break; case "FooterColor": style.ApplyImageColor(Colors.Footer); break; case "HierarchyColor": style.ApplyHierarchyColors(Colors.Hierarchy.NormalItem, Colors.Hierarchy.DisabledItem); break; case "ProjectFolderColor": style.ApplyImageColor(Colors.ProjectFolder); break; case "ConsoleButtonColor": style.ApplySelectableColor(Colors.ConsoleButton.Normal, Colors.ConsoleButton.Highlight, Colors.ConsoleButton.Pressed, Colors.ConsoleButton.Disabled); break; case "ScrollBarColor": style.ApplySelectableColor(Colors.ScrollBar.Normal, Colors.ScrollBar.Highlight, Colors.ScrollBar.Pressed, Colors.ScrollBar.Disabled); break; case "ScrollBarBackgroundColor": style.ApplyImageColor(Colors.ScrollBarBackground); break; case "ToggleColor": style.ApplySelectableColor(Colors.Toggle.Normal, Colors.Toggle.Highlight, Colors.Toggle.Pressed, Colors.Toggle.Disabled); break; case "ToggleButtonColor": style.ApplySelectableColor(Colors.ToggleButton.Normal, Colors.ToggleButton.Highlight, Colors.ToggleButton.Pressed, Colors.ToggleButton.Disabled); break; case "InputFieldColor": style.ApplyInputFieldColor(Colors.InputField.Normal, Colors.InputField.Highlight, Colors.InputField.Pressed, Colors.InputField.Disabled, Colors.InputField.Selected); break; case "InputField2Color": style.ApplyInputFieldColor(Colors.InputField2.Normal, Colors.InputField2.Highlight, Colors.InputField2.Pressed, Colors.InputField2.Disabled, Colors.InputField2.Selected); break; case "ButtonColor": style.ApplySelectableColor(Colors.Button.Normal, Colors.Button.Highlight, Colors.Button.Pressed, Colors.Button.Disabled); break; case "Button2Color": style.ApplySelectableColor(Colors.Button2.Normal, Colors.Button2.Highlight, Colors.Button2.Pressed, Colors.Button2.Disabled); break; case "SliderColor": style.ApplySelectableColor(Colors.Slider.Normal, Colors.Slider.Highlight, Colors.Slider.Pressed, Colors.Slider.Disabled); break; case "DropdownColor": style.ApplySelectableColor(Colors.Dropdown.Normal, Colors.Dropdown.Highlight, Colors.Dropdown.Pressed, Colors.Dropdown.Disabled); break; case "ToolCmdItemColor": style.ApplyToolCmdItemColor(Colors.ToolCmdItem.Normal, Colors.ToolCmdItem.Highlight, Colors.ToolCmdItem.Pressed); break; } } }