private static void PopulateStyle(StyleSheetCache cache, StyleComplexSelector complexSelector, GUIStyle style, bool throwIfIncomplete = false) { var rule = complexSelector.rule; var complexSelectorStr = StyleSheetToUss.ToUssSelector(complexSelector); var sheet = cache.sheet; // GUIStyle.alignment GetProperty(rule, ConverterUtils.k_TextAlignment, throwIfIncomplete, property => { style.alignment = ConverterUtils.ToTextAnchor(sheet.ReadEnum(property.values[0])); }); // GUIStyle.border ReadRectOffset(cache, rule, ConverterUtils.k_Border, "", throwIfIncomplete, style.border); // GUIStyle.clipping GetProperty(rule, ConverterUtils.k_Clipping, throwIfIncomplete, property => { style.clipping = ConverterUtils.ToTextClipping(sheet.ReadEnum(property.values[0])); }); // GUIStyle.contentOffset GetProperty(rule, ConverterUtils.k_ContentOffset, throwIfIncomplete, property => { style.contentOffset = StyleSheetBuilderHelper.ReadVector2(sheet, property); }); // GUIStyle.fixedHeight GetProperty(rule, ConverterUtils.k_Height, throwIfIncomplete, property => { style.fixedHeight = sheet.ReadFloat(property.values[0]); }); // GUIStyle.fixedWidth GetProperty(rule, ConverterUtils.k_Width, throwIfIncomplete, property => { style.fixedWidth = sheet.ReadFloat(property.values[0]); }); // GUIStyle.font GetProperty(rule, ConverterUtils.k_Font, false, property => { style.font = ReadResource <Font>(sheet, property); }); // GUIStyle.fixedWidth GetProperty(rule, ConverterUtils.k_FontSize, throwIfIncomplete, property => { style.fontSize = (int)sheet.ReadFloat(property.values[0]); }); // GUIStyle.fontStyle ReadFontStyle(sheet, rule, throwIfIncomplete, style); // GUIStyle.imagePosition GetProperty(rule, ConverterUtils.k_ImagePosition, throwIfIncomplete, property => { style.imagePosition = ConverterUtils.ToImagePosition(sheet.ReadEnum(property.values[0])); }); // GUIStyle.margin ReadRectOffset(cache, rule, ConverterUtils.k_Margin, null, throwIfIncomplete, style.margin); // GUIStyle.name GetProperty(rule, ConverterUtils.k_Name, throwIfIncomplete, property => { style.name = sheet.ReadString(property.values[0]); }); // GUIStyle.overflow ReadRectOffset(cache, rule, ConverterUtils.k_Overflow, null, throwIfIncomplete, style.overflow); // GUIStyle.padding ReadRectOffset(cache, rule, ConverterUtils.k_Padding, null, throwIfIncomplete, style.padding); // GUIStyle.richText GetProperty(rule, ConverterUtils.k_RichText, throwIfIncomplete, property => { style.richText = ReadBool(sheet, property); }); // GUIStyle.stretchHeight GetProperty(rule, ConverterUtils.k_StretchHeight, throwIfIncomplete, property => { style.stretchHeight = ReadBool(sheet, property); }); // GUIStyle.stretchWidth GetProperty(rule, ConverterUtils.k_StretchWidth, throwIfIncomplete, property => { style.stretchWidth = ReadBool(sheet, property); }); // GUIStyle.wordWrap GetProperty(rule, ConverterUtils.k_WordWrap, throwIfIncomplete, property => { style.wordWrap = ReadBool(sheet, property); }); ReadState(cache, rule, style.normal, throwIfIncomplete); ReadState(cache, complexSelectorStr, style.active, "active", throwIfIncomplete); ReadState(cache, complexSelectorStr, style.focused, "focused", throwIfIncomplete); ReadState(cache, complexSelectorStr, style.hover, "hover", throwIfIncomplete); ReadState(cache, complexSelectorStr, style.onActive, "onActive", throwIfIncomplete); ReadState(cache, complexSelectorStr, style.onFocused, "onFocused", throwIfIncomplete); ReadState(cache, complexSelectorStr, style.onHover, "onHover", throwIfIncomplete); ReadState(cache, complexSelectorStr, style.onNormal, "onNormal", throwIfIncomplete); }