Jump to content

PopupDialog behind rest of UI?


Recommended Posts

I'm trying to build a small UI with a popup dialog showing an error message. Now, the UI shows (GUILayout. Horizontal/Vertical and things like that used) and then at the end I do this

if(bError)

PopupDialog.SpawnPopupDialog(...)

and the dialog with my error messages is shown behind the rest of the UI. What am I missing? How is the z-order defined? I didn't find anything about that... but, to be honest, I've no idea what I have to search for...

Any ideas what's wrong?

Link to comment
Share on other sites

What scene is it spawning in, and which part of the UI is it behind?

If it is behind the UI for another mod, or anything that uses the old UI then there is nothing you can do about. OnGUI stuff is always drawn on top of everything else.

Link to comment
Share on other sites

If your window is drawn with OnGUI (using GUILayout as you mentioned above), then there is nothing you can do about it. You could try moving the popup, but the only real solution is not to use OnGUI.

Link to comment
Share on other sites

Now that's interesting... and explains a lot. Thank you...

Just one follow up... how would you build a "configuration window" in the space center scene? directly using a popup dialog? or are there other ways?

(sorry, I'm new to unity... I could tell you a lot about windows in Win32... but as I see, it's completely different here ... but maybe I can find a good tutorial now that I know what I have to search for...)

Link to comment
Share on other sites

1 hour ago, Rudolf Meier said:

how would you build a "configuration window" in the space center scene? directly using a popup dialog?

Yes, that can be done, and it works well enough.

1 hour ago, Rudolf Meier said:

or are there other ways?

Yes:

 

Link to comment
Share on other sites

If your pretty new to new UI stuff than I would go with popup option, sounds like you have little experience with ongui.  And that's pretty close to it, but not really, lol.  

While your in that you might as well get localization down too, regret it if you want it later.

 

Link to comment
Share on other sites

The old GUILayout is great for complex UI's with it's robust set of features. the new DialogUI system is good for simple UI's like popup messages, but a complete pain in the cheeks to develop.

if I were you, I'd combine the two and dread the day when the old GUILayout is no more

Edited by Xyphos
Link to comment
Share on other sites

1 hour ago, Xyphos said:

The old GUILayout is great for complex UI's with it's robust set of features. the new DialogUI system is good for simple UI's like popup messages, but a complete pain in the cheeks to develop.

if I were you, I'd combine the two and dread the day when the old GUILayout is no more

I personally would not combine the two.  But to each own, if you want to make the new GUI as robust as the old you can, but like you said it's work.  But it's about the same amount of work as setting up the old system.  And it's much less resource heavy and faster.

when your updating from old too new line me you notice these things.  On GUI is very sluggish, you might not notice it if your only using that.  But you do when your watching the difference in testing.

Link to comment
Share on other sites

Thanks a lot for all that input... it's right, I never worked with Unity up to now. But, the concept of OnGUI is something I don't like (that's what I already know) ... so, I think I'm going to work through the sugestet tutorial and try it that way. It seems to be more like what I'm used to work with...

 

Link to comment
Share on other sites

Aside from being a performance drain and clunky to work with, OnGUI is esoteric, anything you learn while using it is basically useless for anything else.

The new Unity UI has a few of its own eccentricities, like the RectTransform, but its basic design is shared with just about every other aspect of Unity design, and therefore KSP design.

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...