Example #1
0
        public static void Open(SerializedProperty property)
        {
            GeocodeAttributeSearchWindow window = EditorWindow.GetWindow <GeocodeAttributeSearchWindow>(true, "Search for location");

            window._property = property;

            Event   e        = Event.current;
            Vector2 mousePos = GUIUtility.GUIToScreenPoint(e.mousePosition);

            window.position = new Rect(mousePos.x - width, mousePos.y, width, height);
        }
Example #2
0
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            _property = property;

            float buttonWidth = EditorGUIUtility.singleLineHeight * 4;

            Rect fieldRect  = new Rect(position.x, position.y, position.width - buttonWidth, position.height);
            Rect buttonRect = new Rect(position.x + position.width - buttonWidth, position.y, buttonWidth, EditorGUIUtility.singleLineHeight);

            EditorGUI.PropertyField(fieldRect, property);

            if (GUI.Button(buttonRect, searchButtonContent))
            {
                GeocodeAttributeSearchWindow.Open(property);
            }
        }