Sign in to follow this  

Unity IMGUI

This topic is 1250 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I post here because the forums at Molly Rocket seem more dead than tank tops.

I'm looking into this for a second time and i really can't decide whether:

a) Everything i want to do with it is possible.
b) It's actually any more simple than a well written RMGUI.


To those of you here that have written a decent IMGUI, or have atleast attempted one, i'd like to know how you:

a) Implemented modal dialogs.
b) Implemented draggable windows.
c) How did you identify a control between frames? I don't think the user passing an ID in to each Do*() method is an acceptable solution.
d) Do you have a designer for it or is it all hand coded? In most cases not having a designer is not acceptable.
e) Did you notice any performance issues when doing multiple passes over the UI code. It has been suggested that to solve the modal problem you need to do an examination pass before the input pass in order to detect ahead of time that something is modal.
f) Did you find any performance issues with alot of widgets?
g) How did you persist state between frames?

It also appears that the Unity 3D Editor is written entirely in an IMGUI and it's certainly pretty complex and this is encouraging however im not sure i believe it to be true yet as running fraps gives a framerate only for the game window. Not sure why the rest of the Unity Editor ui doesnt have a framerate if it is indeed immediate.

IMGUI or RMGUI guys, i don't see the answer yet, what's your take?

Share this post


Link to post
Share on other sites
Personally I think the immediate mode gui is not sufficiently simpler to implement over a retained mode gui. Their implementations are mostly identical, except that with an immediate mode gui you define your gui with more implementation. Why not take the additional small step to store the parameters of the gui in some structure? It's not that much additional work. From that point it's only another small step to be able to define your gui outside of code. Edited by smr

Share this post


Link to post
Share on other sites

To my own surprise, it has been more than two years since I asked something about designing a GUI.
My efforts on IMGUI resulted in a total loss. At the end, I ran out of time and I had to go back to the legacy GUI system.
It appears to me that IMGUI hasn't delivered. Many people would object that IMGUI is just GUI as it has always have been on consoles. That might be the case but a generic system is a different thing from a specific system.
I am very worried about the fact unity is still noted as example two years later. I would expect something more.

My main concern is that IMGUI proponents appear to be selling on

  • IMGUI is easier
  • IMGUI is implicit
  • IMGUI can do everything RMGUI can

It appears to me that those, taken alone, are true statements. But I'm not really sold they are true at the same time.
Take for example "can do everything RMGUI can". No, it cannot. Examples in the thread I've linked. It can do so only if IDs are generated and this is non-trivial. Once you generate IDs, say goodbye to the "implicit" part of the discussion.
And, to be honest, after trying to implement it, even for a barebone system, I'm unsure it's really "easier".
Sure it's not going to plug with the usual workflow without some effort.

Personally, when I first read CEGUI documentation, there was so much emphasis on Lua at the time I had the impression in was a very important requirement. It isn't the case, and I'm now looking at a complete CEGUI integration. So everything about that is now irrelevant to me.

Share this post


Link to post
Share on other sites
Thanks for replying guys.

@smr - Yes i agree

@Krohm - Your thread there was one that i came across while researching this. As you say it's kinda surprising that for a technique that is supposedly so much better that there are still only very few (if not only one) commercial examples of it in use. I suffer the same problems as you did in that thread and i think it is clear that an RMGUI is the most suitable solution for me in my project.

I was actually scripting my IMGUI with Lua and to be honest that was quite powerful in itself, but it wasn't scalable.

Thanks,

Share this post


Link to post
Share on other sites
I think Zipster hit it spot on.

RMGUI's cater towards artists/designers at the front of the pipleline and programmers at the end. IMGUI is the exact opposite - programmers will implement the logical components of the gui and then can expose the data (layout, color, theme, etc) for artists/designers to tweak.

I suppose it really depends on the project/team you are working with. If your engineers are nothing more than code monkeys, and need specific requirements for everything they write, then RMGUI may be best suited. However, if the engineers are making more of the design decisions, and you just want to outsource your art, then IMGUI may be best suited.

To answer some of the OP questions:
a) I would implement modal dialogs as part of a layered screen system, and use multiple IMGUI objects. You can push and pop "screens" onto the stack and trap input to the top level. Typically though, IMGUI does not support overlapping widgets.

b) Draggable windows are implemented by returning the (x, y) position of the window out of the function, and using them as inputs for the next frame. The IMGUI will store the mouse drag information in it's internal state.

c) I don't think you can identify controls throughout a frame. All widgets are independent of eachother. I'm having trouble coming up with reasons why you need to identify a control with IMGUI.

d) As in the paragraph above, IMGUI is probably better suited for programmers at the beginning of the pipeline (i.e. hand coded), and then expose whatever data you need tweaked to the artists. Using a generic designer to be later implemented into the game by programmers doesn't really make sense to me with IMGUI. The IMGUI is tightly coupled to the code flow.

e) I don't have an answer.
f) I don't have an answer.

g) An IMGUI can store whatever data it needs between frames. Typically it stores a variety of IDs that reference to what widget is 'hot' or 'active'. The key point about IMGUI is that typically only one widget can be interacted with at a time, so storing state in every individual widget is a waste.

Share this post


Link to post
Share on other sites
[quote name='web383' timestamp='1354641986' post='5007136']
c) I don't think you can identify controls throughout a frame. All widgets are independent of eachother. I'm having trouble coming up with reasons why you need to identify a control with IMGUI.[/quote]Because you might need to associate a specific state with it. If the state is part of the model, that's no trouble (except the code needs to cater with this possibility). If the state is part of some external setting (such as skinning) the code has no way to deal with this. When scripting enters the picture the need for robust state association becomes a priority (as mis-guessing a control state association might violate some invariant).

Personally, after IMGUI, I looked at cocoa bindings and I found them quite more promising. Unfortunately, the amount of machinery required to make them work is scary.

Share this post


Link to post
Share on other sites
Thanks for the replies guys, i think given that there is still so much doubt over how some of the issues i mentioned might be solved im just going to revert back to a retained GUI. I know however is solved in there.

Share this post


Link to post
Share on other sites

Hello,

I stumbled on this topic while searching for the keyword. Recently released my ImGui implementation here fyi https://github.com/ocornut/imgui

On your questions,

 

" a) Implemented modal dialogs. "

 

That's not a really a problem for the low-level ImGui. My implementation allows to create any number of window - ImGui::Begin("window 1"): ImGui::End()

 

" b) Implemented draggable windows. "

 

The library context knows on which "window" you are adding widgets to and they are created relative to a window position. It draws windows sorted, allow you to move/resize them.

 

" c) How did you identify a control between frames? I don't think the user passing an ID in to each Do*() method is an acceptable solution. "

 

Controls typically have a string so you are already passing an ID.

Add an identifier stack (per-window+explicit push/pop) to resolve collisions in case of looping or recursing or opening node, it works really easily you rarely have to worry about identifiers.

 

" d) Do you have a designer for it or is it all hand coded? In most cases not having a designer is not acceptable. "

 

Mine is hand coded, a designer would defeat its purpose. Frankly I think UI designers are backward at least for the kind of things I am using it for. I can create a new tools in a matter of minutes, without even restarting my application (using modern C++ compiler with Edit&Continue or calling via a scripting language).

 

" e) Did you notice any performance issues when doing multiple passes over the UI code. It has been suggested that to solve the modal problem you need to do an examination pass before the input pass in order to detect ahead of time that something is modal. "

 

I am not doing multiple passes.

 

" f) Did you find any performance issues with alot of widgets? "

 

Performance are alright, we have pretty complex UI (data browsing, debugger) that gets created/updated/render in less than a millisecond - that include traversing source data.

" g) How did you persist state between frames? "

 

Via implicit ID. The library just track what it needs but that's very little.

 

To be clear, I agree it is harder to implement automatic layout in ImGui types of library. I just don't think automatic layout are actually that useful, it's very easy to achieve layout programatically. So my stance is to keep the ImGui very simple to use rather than clutter it with things liek half assed multi-pass attempt.

 

Been using it and team shipped games with it (PixelJunk Shooter 1/2, PixelJunk 4am, Tearaway). Still usiang it for subsequent pro and homebrew projects.

Edited by ocornut

Share this post


Link to post
Share on other sites

This is a pretty old topic, it's pretty unlikely that the original poster is still looking for answers to this -- thanks for adding the information for any future searchers who land on this though -- I'm closing this one, but if anyone stumbles upon this and has related questions please feel free to start a new topic.

 

//EDIT:  This is a topic that isn't discussed particularly frequently, and it seems this particular topic ranks pretty well on search engines, so I've changed my mind -- I'm going to leave it open for now in case anyone else wants to contribute.  An old topic being brought back from the dead really isn't harmful if new information is added, especially if it's one that is likely to be found in searches. smile.png

Edited by jbadams
Re-opening topic.

Share this post


Link to post
Share on other sites

This topic is 1250 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

  • Similar Content

    • By Redlime
      I am a game development student working on a 2.5D beat 'em up brawler game in Unity as my final year project and I've been working on the ai for the enemies in the game. However, I've been unable to get the enemies to working properly as the enemies would be constantly stuttering and jerking while trying to follow the player. I've created a foreach statement and added some conditions that call for the robots to spread out and stay away from the player if it is not in an engaging enum state. This has been an issue plaguing the ai for a while now, analysing the animator, it seems like the robot's movement is instantaneously stopping and going which might be the reason causing this stuttering. But I'm not sure how to prevent the robot's movement from stopping and going. If anyone knows the reason why this is happening to the robots it would be much appreciated as my project is due soon and I'm still unable to fix such a game breaking bug! I've included a few videos below showing what is happening to my robots and also the stuttering shown inside the animator. I've also included the full script for my robots.
       
      Robots Stuttering
      Robots Stuttering Animator
      Robot.cs
    • By red1m3n
      Hi I'm a hobbyist getting together a team to pursue game creation, we'll do both 2D and 3D games, we would definitely build different types of games, and hopefully have a great time doing it. you dont have to have much experience, just enough that you think you can fill the position. I have plenty of ideas for games that I'd love your help with, and am completely open to fulfilling your game ideas . As of right now this is a for fun project thing, but if me and my team are satisfied with our work it can be published to steam or other platforms. 
      The positions I'm currently looking to fill are:
      2D Pixel artist
      3D Modeler 
      C# programmer
      Musician/Sound engineer
      I am currently working on a project it is a 2D Merchant adventure game with survival elements. It does not have a name yet, that's because I'm bad with names. 
       
      If interested please feel free to leave me a PM or email at dealtavu@gmail.com so we can talk more about it..
    • By Aggrojag
      Hello!
      I'm working on a game that is quite personal to me. It touches on my own depression, obsessions, phobias, etc. It's a narrative driven dark comedy with some small aspects of platforming and puzzle solving. The project is rather small as well. It touches on topics such as suicide, mental illness, family, corruption, free-will, and redemption.
      First, I'm looking for a 2D animator that can compliment the style of the attached image. The player character's animations will be a bit more extensive than a typical platformer. There will be many death animations, and some other strange dealings with the character that will need animation. Other items will include some objects in the world that are in need of animation. All static pieces of art will be handled by the artist that drew the attached image.
      Second, I'm looking for a male voice actor. There will be at minimum two characters that will need to be brought to life through vocals. They are a very core part of the game, though they will never be shown on screen. As a reminder, this is a rather dark comedy, so be prepared for some insanity in your portrayal of these characters. The first voice is that of a game show host's voice, while the other will be a devilish voice (without SFX, I think it cheapens it, does not necessarily need to be a low voice, this is more about the portrayal than how the voice sounds).
      Last, I would love to have an editor on board. More than just avoiding disaster in the writing, I'm looking for someone that can elevate it. There is not a ton of writing that will be in the final project, but it's important enough of an aspect to be trying to bring someone in to help with it.
      To those interested:
      I have a crappy prototype that exists, along with a couple game design docs. More than anything, I'd like to present the project through a voice chat via discord to any interested. Discord - Bobdul Thundercuck#4590
      I do plan to post this on itch.io and wherever else I can put it that makes sense. I fully expect to make nothing off this project, as should you. However, in the case that money is made, a rev share model will be in place.

       
      Edit: Editor position has been filled, title has been changed to reflect this, and crossed out the section detailing this.
    • By William Edmeades
      Hey guys and girls,   Have you ever found yourself trying to apply for a job to be a game developer or a game artist? Maybe a sound engineer or a script writer? Only to not even get an interview due to lack of ‘experience’, teamwork projects or released game titles you have worked on? I have for sure. The game industry is hard and competitive to get into for someone new, especially when you might have a full time job or even have to support a family. So I have come up with an idea and I wanted to throw something out there to see if people could be interested in such an idea.   What if you could be part of a virtual game development company? A place where you can work on projects with a team of people from the internet, soon to be known as your colleagues, which could be from anywhere in the world all working at your own pace when you have time to do as little or as much as you want.   The idea is we can create the power of a company and release titles together. Not only do you then have a released game title you have worked on under your resume, but also work experience, team work skills, and the power of helping each other and learning from each other.    My dream idea is to create a solid place for people to join a party and develop ideas and create games and level up it experience points.   As far as money is concerned, the games would either be released for free or any money would go towards charity, it’s not about making money, it’s about building a career or justness having fun building games and socialising with like minded people.    I want to make something amazing, I think it would benefit me, and I think others who are serious would benefit greatly too.   I await your critasism on the ‘prototype’ idea, I just wanted to see how many people would be interested in such a concept. And if you are very much into the idea, let’s make it happen.   Thanks,   Will. www.feelingterrible.com
    • By NDraskovic
      Hey guys,
      Like the title says, I'm trying to find out if it's possible to automatically set which scenes will be built for different platforms. For instance, I have scenes that I want to include when building for PC, but exclude them for mobile platforms. Is it possible to do this automatically (by some settings file, or by coding some editor extension), or do I have to manually (de)select them each time I switch platforms?
      Google just keeps sending me to the documentation sites about the regular publishing, but I can't find information about this problem.
      Thanks in advance
  • Popular Now