예제 #1
0
 /// <summary>
 /// Gets the height of the property.
 /// </summary>
 /// <returns>The property height.</returns>
 /// <param name="property">Property.</param>
 /// <param name="label">Label.</param>
 public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
 {
     // ensure property's decorator height is registered
     if (!decoratorHeights.ContainsKey(property.propertyPath))
     {
         decoratorHeights.Add(property.propertyPath, 0f);
     }
     decoratorHeights[property.propertyPath] = 0f;
     if (DrawerToUse != null)
     {
         return(DrawerToUse.GetPropertyHeight(property, label));
     }
     else
     {
         float result = EditorGUI.GetPropertyHeight(property, label, true);
         if (!property.IsArrayElement())
         {
             foreach (PropertyAttribute attr in fieldInfo.GetCustomAttributes <PropertyAttribute>())
             {
                 GUIDrawer drawer = SerializedPropertyX.GetGUIDrawer(fieldInfo, attr);
                 if (drawer is DecoratorDrawer)
                 {
                     float height = (drawer as DecoratorDrawer).GetHeight();
                     result -= height;
                     decoratorHeights[property.propertyPath] += height;
                 }
             }
         }
         return(result);
     }
 }
예제 #2
0
 /// <summary>
 /// Gets the height of the property.
 /// </summary>
 /// <returns>The property height.</returns>
 /// <param name="property">Property.</param>
 /// <param name="label">Label.</param>
 public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
 {
     if (DrawerToUse != null)
     {
         return(DrawerToUse.GetPropertyHeight(property, label));
     }
     else
     {
         return(property.GetDrawerHeight(label));
     }
 }