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. Dismiss Notice

Absolutely at a loss

Discussion in 'Immediate Mode GUI (IMGUI)' started by Slev, Sep 18, 2014.

  1. Slev

    Slev

    Joined:
    Sep 8, 2012
    Posts:
    148
    I have tried both Unity GUI and the new UI elements and all of them lack fundamental things I would like, such as drop down menus, better dynamic resizing. I do not have the money to shell out for NGUI or Scaleform and there seems to be no alternatives. Is there anything I can do to get good GUI tools without spending way too much money?
     
  2. N1warhead

    N1warhead

    Joined:
    Mar 12, 2014
    Posts:
    3,884
    I made a little tutorial on 3d GameObjects for Health.... I'm sure it could work just as well, just change a few things up.

    Such as, if I press H on keyboard. Cut the renderer on for this 3d Game object, and make things on it clickable.
    I find it much easier to use 3d Objects for things as it requires little to no coding whatsoever. At least to make things workable.

    http://forum.unity3d.com/threads/3d-gameobject-gui-tutorial-c-beginner-friendly.269546/

    It's in C#, but I provide all the scripts.
    However, I made it for health, but again, just follow the examples of the renderer.enabled.... It's that simple.

    Example.... Press H on Keyboard >> Enabled Mouse Showing & renderer.enabled = true...... Then make the things on it clickable to do what you want......

    However, how to make strings come up is a different thing, but again, it's stuff you'll have to work on, but it is what you pay for. It's free help, so you'll have to build upon it what you'd like.
    If your even interested in it at least.

    Anyways, I hope that helped!
     
  3. Mmmpies

    Mmmpies

    Joined:
    Feb 19, 2014
    Posts:
    31
    DF GUI forum is talking of going opensource, that said my DF GUI menu system broke when I upgraded to the 4.6 public beta and DF GUI was removed from the asset store, so may not be an immediate solution.

    I think the new UI looks promising but is going to need some level of C#/JS skill to do the things you want (and some of the things I want as well) at least until it's had time to bed in.

    I was hoping for a tabstrip system like the one from DF GUI. Looks like I'll have to throw one together myself.

    However you don't want to know my problems so how's this for an idea for your drop down menus:

    In the new UI create a button that, when clicked, tells a sub panel to appear. You can change the alpha of the panel to make it appear. You then have another list of buttons within that panel that forms your drop down for that menu item. When the panel becomes visible set the interactable to true for these buttons.

    Likewise if the menu stops being displayed set the panel alpha to 0 and set all the buttons interactable to false.

    If you have a number of top menu items e.g. File - Edit - Tools - Help then you'd need to enable the one you hover over and press and send a message to the other panels to hide.

    It's a pain to do but it is possible with the new UI. Not sure if you know how to program but if you do just create your script with a function, let's call it "OnClick()" have the script Start() or Awake() function hold references to all other items you want to interact with and set the panel/buttons for those items as I said within the OnClick function.

    Save that script and drag onto your top menu button, so create a script for File and one for Edit etc. and drag each onto the relevant button. Then on that button scroll down in the inspector to the OnClick bit (should be at the bottom) and click the + symbol.

    Then drag the button from the Hierarchy to the Object space where it says "None (Object)" you should then be able to click on the function button to the right and select your script name and the OnClick function you created within that script.

    Sorry it's a bit abstract, I don't really have time to write the code myself but I hope it helps.
     
  4. Mmmpies

    Mmmpies

    Joined:
    Feb 19, 2014
    Posts:
    31
  5. Mmmpies

    Mmmpies

    Joined:
    Feb 19, 2014
    Posts:
    31
    Hi Slev,

    Turns out the tabstrip problem I had would also work for your drop down menus. All you need to do is place an Image at the top of the Canvas that'll act as your button, set a child Text property to display the text you want for that menu and have a Panel that's deselected directly under the Image/button. I don't mean as a child I mean physically under the Image on the canvas.

    Then add a script to the Image (I'll link to the example I created for the tabstrip solution at the bottom of this post. It's pretty similar to what you want).

    Then on the Image add an event trigger Component in the inspector. Well I go through the rest of this in the link. It looks like you can add pretty much whatever you want and the event trigger is great. So I'm really starting to like the new UI, of course your entitled to your own opinion but I like it anyway as it looks like it's massively flexible with a bit of work.

    Of course in your drop down menus you then need to add a load of buttons or labels to use as your dropdown buttons in the hidden panel. When you click on the top menu item the script sets the panel to active and deactivates any other menu panels.

    Works fine for my tabstrips, if you're not a fan of broadcasting messages you can reference the panel in other ways but this should get you started even if you don't know much C#.

    http://forum.unity3d.com/threads/tabstrip-buttons-or-which-button-is-selected.269619/#post-1782169