Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by SonicBloomEric · Feb 11, 2015 at 01:30 PM · guipopup

Popup Window from an EditorWindow?

I'm trying to create a sub-window for an EditorWindow that the user can move around. Something like the built-in AnimationCurve Editor Window. I've tried two separate ways so far but to no avail. To quickly rehash:

  1. GUILayout.Window - I attempted to use the GUILayout.Window function. This worked well until I realized that if it was positioned over other controls, those would take precedence because of how the IMGUI event system handles input. So I attempted to move the code to the top of my OnGUI call but that didn't work because the popup started drawing below the normal controls. I then tried overriding Event.current.type at the beginning if it was a mouse event within the window's Rect and then reset it right before the GUILayout.Window call but that didn't work either. I assume that Event.current.Use() does something internally other than change the type.

  2. PopupWindow.Show - I attempted to use the poorly documented PopupWindow system. I subclassed PopupWindowContent and used PopupWindow.Show to display it. I always get an exception of the type UnityEngine.ExitGUIException, regardless of whether I call it in OnEnable, OnGUI, or Update.

NOTE: #1 above would create a pop-up that cannot leave the EditorWindow and #2 would create a pop-up that's separate from the EditorWindow. Either is fine.

Has anyone else accomplished something like this? Does anyone have any ideas on how to do this?

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
â–¼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by SonicBloomEric · Feb 11, 2015 at 05:47 PM

[I posted a similar question to the Beta list and got a response there. I'm going to answer my own question here with information gleaned from that conversation in case anyone else comes across this while trying to solve a similar problem.]

The best way to do this (see: Color Picker or Object Picker popup windows) is to create a new Utility Window and have it interact with the main window. This is accomplished by calling the EditorWindow.ShowUtility method (there's an example in the documentation at that link).

As a clarification regarding the PopupWindow system, it appears to be linked to the EditorWindow.ShowPopup method call; a shortcut, if you will. Another possibly(?) related and definite shortcut would be EditorGUI.Popup. These all appear to do something very similar: create a hovering context that's locked to a specific location (or GUI Control). Adding to the confusion, EditorWindow.ShowAsDropDown also exists and does nearly the exact same thing as ShowPopup...

Hopefully Unity will update the documentation to make distinctions and examples more clear.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
â–¼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

2 People are following this question.

avatar image avatar image

Related Questions

Is it possible to have a spectrum analyzer display for each song in a playlist? 1 Answer

individual object menu 0 Answers

Overlapping GUI Button priority 3 Answers

The popup when clicking an EditorGUI.EnumPopup inside a scaled GUI.matrix, is opened in the wrong location 1 Answer

GUI Popup problem…! 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges