static bool IsLength(string name) { if (BuilderConstants.SpecialSnowflakeLengthSytles.Contains(name)) { return(true); } #if UNITY_2019_3_OR_NEWER return(false); #else foreach (System.Reflection.PropertyInfo field in StyleSheetUtilities.ComputedStylesFieldInfos) { var styleName = BuilderNameUtilities.ConverStyleCSharpNameToUssName(field.Name); if (styleName != name) { continue; } var dummyElement = new VisualElement(); var val = field.GetValue(dummyElement.computedStyle, null); if (val is StyleLength) { return(true); } } return(false); #endif }
PropertyInfo FindStylePropertyInfo(string styleName) { var cSharpStyleName = ConvertUssStyleNameToCSharpStyleName(styleName); foreach (PropertyInfo field in StyleSheetUtilities.ComputedStylesFieldInfos) { var styleNameFrom = BuilderNameUtilities.ConverStyleCSharpNameToUssName(field.Name); if (styleNameFrom == cSharpStyleName) { return(field); } } return(null); }