Ejemplo n.º 1
0
        public static float GetHeight(SerializedProperty property, Type type)
        {
            if (SOArchitecture_EditorUtility.HasPropertyDrawer(type))
            {
                return(EditorGUI.GetPropertyHeight(property));
            }
            else
            {
                property = property.Copy();

                int elements = 0;

                PropertyIterator iter = new PropertyIterator(property);
                do
                {
                    ++elements;
                }while (iter.Next());

                iter.End();

                float spacing        = (elements - 1) * EditorGUIUtility.standardVerticalSpacing;
                float elementHeights = elements * EditorGUIUtility.singleLineHeight;

                return(spacing + elementHeights);
            }
        }
Ejemplo n.º 2
0
        public static void DrawPropertyDrawerLayout(SerializedProperty property, Type type, bool drawLabel = true)
        {
            if (property == null)
            {
                Debug.LogError(NullPropertyText);
                return;
            }

            if (SOArchitecture_EditorUtility.HasPropertyDrawer(type))
            {
                if (drawLabel)
                {
                    EditorGUILayout.PropertyField(property);
                }
                else
                {
                    EditorGUILayout.PropertyField(property, GUIContent.none);
                }
            }
            else
            {
                PropertyDrawIteratorLayout iter = new PropertyDrawIteratorLayout(property.Copy(), drawLabel);

                DrawPropertyDrawerInternal(iter);
            }
        }