internal static void PopulateFromUSS(StyleCatalog catalog, GUIStyle style, string blockName, string ussInPlaceStyleOverride) { // Override with style in catalog PopulateStyle(catalog, style, blockName); if (!string.IsNullOrEmpty(ussInPlaceStyleOverride)) { try { if (!ussInPlaceStyleOverride.Contains("{")) { // A bit of sugar syntax in case the user doesn't provide the uss class declaration. ussInPlaceStyleOverride = $".{ConverterUtils.EscapeSelectorName(style.name)} {{\n{ussInPlaceStyleOverride}\n}}"; } var styleSheet = ConverterUtils.CompileStyleSheetContent(ussInPlaceStyleOverride); var overrideCatalog = new StyleCatalog(); overrideCatalog.Load(new[] { styleSheet }); const bool useExtensionDefaultValues = false; PopulateStyle(overrideCatalog, style, blockName, useExtensionDefaultValues); } catch (Exception e) { Debug.LogError("Cannot compile style override:" + e); } } }