Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

PropertyDrawer and popup's

Discussion in 'Editor & General Support' started by sniffle63, Oct 26, 2018.

  1. sniffle63

    sniffle63

    Joined:
    Aug 31, 2013
    Posts:
    363
    Im currently trying to make a property drawer for a custom class and my popup window is always displayed at the bottom of the drawer. SO basically my question is..

    Is there anyway to position a popup window's position in a property drawer, or can the popup only be displayed as the last element in a property drawer? When you use the Rect position on the EditorGUI.Popup its referring to the button you push to open the window. But not the positioning of the window opened. I cant seem to find anything for interacting with that window besides displaying an array of strings

    iv looked threw editorStyles.popup and dont see anythign for the actual window

    https://hastebin.com/omajoduwik.http

    thats the property drawer code stripped down to only the popup window
     
  2. sniffle63

    sniffle63

    Joined:
    Aug 31, 2013
    Posts:
    363
    Figured id answer my own question. I misunderstood the size part of the rect that daws the button for the popup window.
    i changed
    Rect buttonRect = new Rect(position.position, position.size);

    too
    Rect buttonRect = new Rect(position.position, new Vector2(EditorGUIUtility.singleLineHeight, EditorGUIUtility.singleLineHeight));
     
  3. PPE-TrackMan

    PPE-TrackMan

    Joined:
    May 4, 2021
    Posts:
    9
    Points for answering you own question!
    Thank you, it helped me.