Exemplo n.º 1
0
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            float width          = position.size.x;
            float propertyHeight = EditorGUI.GetPropertyHeight(property);

            HorizontalScope.Begin(position.x, position.y, propertyHeight);
            EditorGUI.PropertyField(HorizontalScope.NextRect(0f, width), property, new GUIContent(m_Name, m_ToolTip), true);
            if (!property.isExpanded)
            {
                return;
            }
            HorizontalScope.NextLine(2f, 18f);
            HorizontalScope.NextRect(0f, width * 5f / 6f);
            if (GUI.Button(HorizontalScope.NextRect(0f, width / 6f), "Edit"))
            {
                GUITransformHandles.Begin(m_PositionProperty, m_DirecitonProperty);
            }
        }
Exemplo n.º 2
0
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            if (!OnGUIAttributePropertyCheck(position, property, out PositionAttribute attribute, SerializedPropertyType.Vector3))
            {
                return;
            }

            Rect propertyRect = new Rect(position.position, position.size - new Vector2(0, 20));

            EditorGUI.PropertyField(propertyRect, property, label, true);
            float buttonWidth = position.size.x / 5f;
            Rect  buttonRect  = new Rect(position.position + new Vector2(buttonWidth * 4f, EditorGUI.GetPropertyHeight(property, label, true)), new Vector2(buttonWidth, 20f));

            if (GUI.Button(buttonRect, "Edit"))
            {
                GUITransformHandles.Begin(property);
            }
        }