Search Unity

EZ GUI - Powerful, Low draw call GUI solution

Discussion in 'iOS and tvOS' started by Brady, Jun 3, 2010.

  1. elveatles

    elveatles

    Joined:
    May 2, 2009
    Posts:
    147
    Alright, I realized what was wrong. There's always one little thing that messes up everything else. I realized my GUI Camera and Main Camera were set to the same depth level so I guess Unity would randomly decide which one would get drawn first on startup. Sorry about the confusion.
     
  2. Brady

    Brady

    Joined:
    Sep 25, 2008
    Posts:
    2,321
    It is pretty scriptable. I'm currently working on a demo project, in fact, that does a wizard like the Castle Storm scene pretty much all in-script. The only thing that must be done in-editor is assigning textures to the controls so as to generate atlases. But you can change control appearances at runtime in-script too by just calling Copy() on a different control prefab that has the appearance you want.

    PM me in a couple of days and I should have the demo script you can look at.


    @claravoh

    Got it. I'm checking it out and will get right back to you. Thanks!


    @elveaties

    Cool, I'm glad you got it worked out.
     
  3. cecarlsen

    cecarlsen

    Joined:
    Jun 30, 2006
    Posts:
    543
    Thanks for the reply Brady. Quick one:

    Can I change the text on a GUI element via scripting? I suppose that the entire texture atlas has to be recalculated every time that happens?

    ~ce
     
  4. Brady

    Brady

    Joined:
    Sep 25, 2008
    Posts:
    2,321
    Yes, you can change it dynamically (and without any changes to an atlas). The current release uses Unity's TextMesh to do text, but I have a more integrated and more powerful text solution coming in the next release that works very similarly, but will have smoother integration.
     
  5. junkotron

    junkotron

    Joined:
    Feb 22, 2009
    Posts:
    158
    what's the best way to touch drag a 3d object with ez gui?
     
  6. Brady

    Brady

    Joined:
    Sep 25, 2008
    Posts:
    2,321
    I guess that depends on what you mean. You can drag panels around like windows if you use a UIInteractivePanel component with a collider attached.

    But if you mean drag-and-drop, that is not currently supported.

    If you mean drag objects around the scene, as in the "mouse spring" script in the Unity standard assets, that is also not built-in to EZ GUI at the moment, but I imagine it wouldn't be hard to adapt the mouse spring script to do that with touch input.
     
  7. SteveJ

    SteveJ

    Joined:
    Mar 26, 2010
    Posts:
    3,042
    Hi - I'm doing something stupid and need some help :)

    Code (csharp):
    1.  
    2. function Start() {
    3.    var thisButton : UIButton = GetComponent(UIButton);
    4.    thisButton.enabled = false;
    5. }
    6.  
    I have this attached to a gameobject with a UIButton script attached to it. The button has a disabled image etc.

    When I run though, the button's normal image is displayed and it's clickable. I can see that the script is working though as the UIButton is unticked in the Inspector.

    Is .enabled not the correct thing to use here?

    The goal is to add some more logic to the script later to disable this button in certain cases.
     
  8. Lokken

    Lokken

    Joined:
    Apr 23, 2009
    Posts:
    436
    Try this

    Code (csharp):
    1. thisButton.controlIsEnabled = false
     
  9. John-B

    John-B

    Joined:
    Nov 14, 2009
    Posts:
    1,097
    I just got back to my project with a scrolling list. I started over from scratch with the EZ GUI stuff, and now everything is rendering and working correctly. Almost.

    The vertical list displays correctly, but selecting a list item does not work right after the list has been scrolled. If I display the list and select an item, it works. But if I scroll the list before selecting an item, it doesn't. After scrolling, if I click in the lower half of a list item, the item below it is selected. It looks like the area that responds to a click no longer lines up with the list item. Each list item's clickable area is shifted up by half the list item's height relative to the graphic. Does that make sense? Any ideas?
     
  10. Brady

    Brady

    Joined:
    Sep 25, 2008
    Posts:
    2,321
    @sjarman

    Lokken's got it right. The .enabled property is a built-in Unity property that tells whether a component is enabled or not and is not part of EZ GUI.


    @John B

    That sounds really strange. There are couple of things that might be happening here. First, have you tried using the latest beta (1.1 b9)? There were some changes in how list items are handled in that. If it is still doing it with that, you might want to e-mail me a simple sample package privately that I can take a look at to see what's going on.
     
  11. John-B

    John-B

    Joined:
    Nov 14, 2009
    Posts:
    1,097
    The package I downloaded originally is version 1.01. I wasn't aware of any upgrades since then. Where/how do I get the latest beta or release version?
     
  12. Brady

    Brady

    Joined:
    Sep 25, 2008
    Posts:
    2,321
    Check your order confirmation e-mail. It has a link to the online group where you can obtain the latest versions. PM me if you can't find it in there.
     
  13. SteveJ

    SteveJ

    Joined:
    Mar 26, 2010
    Posts:
    3,042
    Thanks guys - that's perfect.
     
  14. elveatles

    elveatles

    Joined:
    May 2, 2009
    Posts:
    147
    I'm having the same problem. I hope to see a post about this soon. I'm using UIListButtons for mine, but I think it should be working similarly. The demo project works. I've been going back and forth between the demo project and my own, and I've found one difference. The demo project seems to automatically set the Render Camera for the list items, yet the one in my project just sets it to the default Main Camera. After that I tried manually setting all the list item render camera properties immediately after creation, but still no luck.
     
  15. Brady

    Brady

    Joined:
    Sep 25, 2008
    Posts:
    2,321
    Sorry, I think I had replied to claravoh privately after reviewing their project and discovering the cause of the issue. If I remember correctly, in their case the cause was due to the fact the list items didn't have any sprite contents, only text. Since the item/button's collider is calculated based upon the extents of its sprite, the item had a collider of zero size, yielding nothing to click on.

    If this is your case as well, just add a box collider to your button item and size it appropriately. Be sure to use this with the latest beta as some changes were made recently related to custom colliders on list items. But that should do the trick. If that doesn't address your issue, let me know.

    BTW, the render camera is only used for performing pixel-perfect calculations for sizing the control/sprite.
     
  16. John-B

    John-B

    Joined:
    Nov 14, 2009
    Posts:
    1,097
    I just downloaded and imported the 1.1b8 update package, and now none of the buttons or sliders work. They look OK, but do not respond to mouse clicks. And I just realized that it doesn't matter that I didn't save the project as all the asset files have been replaced. But it's late and it's been a long day, so maybe I'm overlooking something. Maybe it will work in the morning.
     
  17. elveatles

    elveatles

    Joined:
    May 2, 2009
    Posts:
    147
    Thanks for the quick reply Brady. I tried to assign images to the buttons, but it's the same deal. I also, tried to create a new one in the demo project and got the same results. I also noticed the colliders end up getting offset some distance if the anchor is something other than MIDDLE_CENTER or TEXTURE_OFFSET. If it's not asking too much, I can send you the modified demo to take a look at.
     
  18. Brady

    Brady

    Joined:
    Sep 25, 2008
    Posts:
    2,321
    @John B

    I hadn't realized b9 wasn't up yet. I just put it up as it supersedes b8. When you get a chance, give that one a shot. If your stuff still isn't working, you may need to double-check that when you imported the new package that the layer masks and cameras didn't get changed. Since you're coming from an older version, it is probable that you'll need to setup the UIManager's new settings for cameras and layers. See tutorial vid #2, I believe, for more info on these new UIManager settings.


    @elveaties

    You should try b9 as it contains changes related to this specifically. Sorry about before, I forgot that b9 hadn't yet been uploaded, but it is there now.

    UPDATE: I tested with some different anchoring methods and there are some problems with collider alignment with anchor modes other than TEXTURE_OFFSET and MIDDLE_CENTER. I've added this to my list of things I'm going to try to address in the next release.
     
  19. ej2009

    ej2009

    Joined:
    Mar 2, 2009
    Posts:
    353
    I'm about to order EZ GUI/SM2 package for my first Unity game, but would like to ask stupid question first: :oops:

    Are these two plugins completely compatible with iPhone Basic? Especially automatic batching of textures etc, or do I need iPhone Pro?
     
  20. Brady

    Brady

    Joined:
    Sep 25, 2008
    Posts:
    2,321
    Yes, they work fully with iPhone basic.
     
  21. SteveJ

    SteveJ

    Joined:
    Mar 26, 2010
    Posts:
    3,042
    Is there a version available that's working with the Unity 3 beta?

    I'm trying to download "EZ GUI 1.1 b9.unityPackage" from the Google group, but it doesn't link to anything - "The page you navigated to does not exist".
     
  22. John-B

    John-B

    Joined:
    Nov 14, 2009
    Posts:
    1,097
    That link doesn't work.
     
  23. John-B

    John-B

    Joined:
    Nov 14, 2009
    Posts:
    1,097
    I got the b8 update working. Just needed to reset a few things, as you said.

    But the list is still behaving the same. After scrolling, the clickable areas do not line up with the list items. They are shifted up in a vertical list.

    I also noticed that the clickable areas seem to be shifted left as well. I thought at first that it was necessary to click on the text of the item, and not the blank space at the right (some list text is shorter than others). Some list items respond only to clicks in their left few pixels. Some have a wider click area than others, but it does not correspond to the width of the text. Again, this only happens after the list is scrolled.
     
  24. ibivibiv

    ibivibiv

    Joined:
    Mar 3, 2007
    Posts:
    81
    Just an FYI, not sure if this is a "bug" or not but I noticed if I assign an animation to a gameobject and then stop time the animation continues to play. In my case I have a pause button that stops time and everything else in the scene freezes except the animation that is assigned to a gameobject with the "do" static method. Great package overall, I love it so far.


    Edit: Ok the more I have played with this the more I think it is a bug. There are some very strange behaviors in my app depending on how I use various animations. I guess if there is a way to globally tell the spritemanger/ezgui animation 'pump' to stop all motion and then a way to resume then that will work, but if there just isn't any way at all I would think this is a bug for sure.
     
  25. ciaravoh

    ciaravoh

    Joined:
    Dec 16, 2009
    Posts:
    252
    Hello Brad,

    b9 is still not available on the google group. Page does not exists. Have you uploaded the files ?

    thank you.

    Hervé
     
  26. ciaravoh

    ciaravoh

    Joined:
    Dec 16, 2009
    Posts:
    252
    it's worse and worse.
    I'm using the EZGui b8 and now, on a fresh new project, I got the following error, doing nothing :

    Assets/Plugins/Sprite Scripts/PackedSprite.cs(20,14): error CS0534: `PackedSprite' does not implement inherited abstract member `AutoSpriteBase.States.set'

    someone an idea ?

    thank you.
     
  27. ibivibiv

    ibivibiv

    Joined:
    Mar 3, 2007
    Posts:
    81
    Here's some more specific info. If I set
    Code (csharp):
    1. Time.timeScale = 0;
    Animations of both sprites and the transition type animations still run. I think maybe there needs to be some linkage between the time implementation in Unity and whatever is driving the sprite and transition time.[/code]
     
  28. Brady

    Brady

    Joined:
    Sep 25, 2008
    Posts:
    2,321
    First, to all, it is beginning to look like Google has all but completely broken downloads from Google groups. I've tried everything I know and newly uploaded files just won't work. So I'm going to be implementing a different solution over the next day or so, so please bear with me. Also, I'll be unveiling the new dedicated forum at my site as well.

    Sorry about all this. I had thought Google would be more reliable than this.


    @John B
    Yes, in the currently available version, the item colliders are not based upon the text (since Unity doesn't expose any information about the size or position of the text mesh itself), and thus the need for a collider to be added to items without sprite graphics. But this wasn't supported perfectly until b9 (which you will have access to soon, I promise). There is still a bug regarding items which have their anchor mode set to something other than the default or MIDDLE_CENTER, and that should be addressed in the full 1.1 release. Also, as the new integrated text is released, colliders will take text into account as well, so this will no longer be an issue.


    @ibivibiv

    Actually, this is by design since you may have a "Pause" menu that appears when the player pauses the game, but if EZAnimator used deltaTime to do animation, the menu would never appear, which would be seriously bad. So instead, it tracks real-time instead of deltaTime. However, you can easily change this by looking in EZAnimator.AnimPump() in EZAnimator.cs. Find the lines bracketed by "Realtime time tracking" and comment it out, and instead uncomment the line bracketed by "deltaTime time tracking".

    In the next release there will be the ability to pause all animations or specific animations separately, as well as unpause animations running for specific objects.


    @ciaravoh

    I got your e-mail and you should be good to go now.
     
  29. ciaravoh

    ciaravoh

    Joined:
    Dec 16, 2009
    Posts:
    252
    Hi Brad,

    I'm back to normal. I'll test again the Collider to be able to click any item in the scroll list.

    Have a good night.

    Hervé
     
  30. Imari

    Imari

    Joined:
    May 26, 2010
    Posts:
    24
    Brady, are you writing a book on Unity?
     
  31. Brady

    Brady

    Joined:
    Sep 25, 2008
    Posts:
    2,321
    No, but I know someone who is. ;) Why do you ask?
     
  32. Mark-Ripley

    Mark-Ripley

    Joined:
    Aug 22, 2007
    Posts:
    118
    OK, I give up. Read the docs, watched the videos, but I just can't get panel transitions to work!

    Here's what I do:

    New project (desktop or iphone)
    Import SM2
    Import EZGUI
    New GameObject, attach UIManager
    New GameObject, attach UIPanel
    Open UIPanel window, set a transition (tried various), set duration to 2 seconds.
    Hit Play

    Nothing happens :(

    I've obviously missed something major, but can't see what it is!
     
  33. ciaravoh

    ciaravoh

    Joined:
    Dec 16, 2009
    Posts:
    252
    Hello brad,

    I've added the Box collider to the GO used as the ItemList in the Scroll List.

    No feedback. When the app is launched, the size of the box collider is reset to 0,0,0. I'm pretty sure it's not a good solution to force the size in the script.

    What do you think ?

    Hervé
     
  34. Brady

    Brady

    Joined:
    Sep 25, 2008
    Posts:
    2,321
    Something has to happen to cause a transition to occur. It is called a transition because it occurs when a control or panel either transitions from one state to another, or when a menu/wizard transitions from one panel to another.

    So for example, if you have setup a "Bring In Forward" transition, then the panel needs to be brought in in the forward directly as part of a UIPanelManager for it to be played. The panels #3 tutorial explains what is meant by this. Alternatively, you can invoke a transition in-code with a line like:

    Code (csharp):
    1.  
    2. panel.StartTransition(UIPanelManager.SHOW_MODE.BringInForward);
    3.  
    Or if the panel is part of a UIPanelManager setup, you can also change panels using code like:

    Code (csharp):
    1.  
    2. panelMgr.BringIn(myPanel);
    3.  
    4. // or
    5.  
    6. panelMgr.MoveForward();
    7.  
    8. // etc.
    9.  

    @ciaravoh

    Was that using the b9 package I sent? It should have addressed that issue as this is a result of the collider getting clipped while outside the viewable area, but with b9 it should be restored as it re-enters the viewable area.
     
  35. b-joe

    b-joe

    Joined:
    Sep 7, 2009
    Posts:
    48
    Hi Brady,

    I have a problem with scripting my Menu. I have an options panel that among other things has some checkboxes that have to allow multiple selection, so I'm using UIStatetoggleButtons with 2 states. To save the options between game sessions I save all values to PlayerPrefs on pressing an OK-button, and retrieve them back in the start function of my menu control script. This works well for all but the checkboxes because the StateNum and DefaultState of UIStateToggleButton are read only. Is there a specific reason for this? How can I work around this?

    Thanks again for your assistance,
    Joe
     
  36. Mark-Ripley

    Mark-Ripley

    Joined:
    Aug 22, 2007
    Posts:
    118
    Many thanks, I've watched the second and third tutorials and now I'm fully up to speed :)

    One thing that puzzled me for a while, was that I wasn't receiving any mouse over or click events. Found out eventually that this was because the button (and collider) was at the very forefront of the ortho camera's viewport. Moved the button back a bit, et voila!

    Any update on where we can grab the b9 build?

    Thanks for your help :)

    M
     
  37. kirua-sama

    kirua-sama

    Joined:
    Mar 21, 2010
    Posts:
    41
    Hi !
    I'm new EZ GUI user and it seems to be great to work with it. I'm quite a noob, so I wonder if I'm doing a well using of EZ.

    I'm trying to make a menu which is present In-Game. So i'm creating 2 MainCamera (One which can have a view in the scene and displace herself and the other one which show the Menu all the time).

    Is it the right way to make an In-Game menu or does it have a better proper solution ?

    Thanks.

    TroubleShooting section :
    Make it child of the main camera :

    --> Cause actually my camera to navigate into the scene cannot be orthographic. So I have to place my button in the FOV of the camera. Then when I'm too close to a wall, my button'll be hide by the wall.

    .... so don't really have another solution at the moment instead of using two main cameras.
     
  38. John-B

    John-B

    Joined:
    Nov 14, 2009
    Posts:
    1,097
    I'm still not able to get my scroll list working correctly (after it has been scrolled). And now, after converting my project to EZ GUI, it crashes on iPad. Since it works in the simulator and it has a large amount of textures, I think it's a memory problem. But I've reduced the number of textures using EZ GUI and it ran before, so I'm not sure what's going on.

    One thing is that I'm still using OnGUI elements for some things. In particular, I need to change the size of some GUITextures, and that doesn't seem to work with a sprite. I can set its width, and it shows correctly in the Inspector while the program is running, but the width of the sprite on screen does not change. Is it not possible to change the size of a sprite while the program is running?
     
  39. ibivibiv

    ibivibiv

    Joined:
    Mar 3, 2007
    Posts:
    81
    Switching to deltaTime works famously, thanks. I did the same thing in the SpriteAnimationPump. Thanks Brady, looking forward to that update. The ability to change time behaviors at an object specific granularity will be amazingly useful.
     
  40. elveatles

    elveatles

    Joined:
    May 2, 2009
    Posts:
    147
    I'm having some strange results with the transitions when using Fading Material and Text or Scaling. If I try to make one panel fade in and slide in while the other fades out and slides out in my case, the material for the one fading in will end up disappearing. Also, using the delay on fading results in some weird stuff.

    For scaling, if I start at Scale = 0, 0, 0 and then change to Scale = 1, 1, 1, the colliders won't work anymore.
     
  41. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,670
    kirua-sama:

    I use 2 cameras with EZGUI, and they work fine. (I actually have 3, as I need a 3D GUI as well...)

    Make sure you are using the most recent version possible, because later updates allow you to set multiple cameras in UIManager.


    I have my main camera (MainCamera) set as a normal perspective camera. I have my GUI/HUD camera (UICamera) set as orthographic. To make positioning easier (and noting that I'm targeting the iPhone with a set screen resolution), I set my UICamera's orthographic size to 1/2 my target screen height (or in this case 160 for wide screen).


    This means I can set my button graphic height and width to be the same as the icon's pixel ratio to be pixel perfect.

    (If you have a variable target resolution, there are other options listed in this forum thread and in the tutorials from A&BSoft for achieving pixel perfect images...)

    To make this work I have a special layer (UILayer) set up using the user defined layers. First Select "add layer"...


    ... and then create a new layer (which I called "UILayer")


    Select your object again. Using the Layer PopUp field:


    Place all of your UI Elements on the UILayer...


    Set your main camera to ignore the UILayer...


    ... and set your UICamera to only render the UILayer ...


    ... and use Depth Only as the the Clear Flag.


    This means you now have your Main Camera rendering your scene and not your buttons, and your UI Camera rendering your buttons and not your scene. You can leave your UI Elements at the "origin" or (0,0,0) and they will not be visible in your scene. If, on the other hand, you have a number of moving UI colliders using EZ GUI, you *could* interfere with other colliders in the world, so there is no reason not to move your UI Family up or away by 1000 units and keep it out of your game space.

    ** Edited to add a note that all UI Objects need to be on the UILayer
     
  42. Brady

    Brady

    Joined:
    Sep 25, 2008
    Posts:
    2,321
    First, I just wanted to announce that I have dedicated forums up now for each of my middleware products here:

    forum.anbsoft.com

    They aren't linked to from elsewhere on my site yet, but a revamp of my site is on my ToDo and that'll occur then. But until then, you can go ahead and start posting there if you like. It might make it a bit easier for everyone to find the answers they need more quickly.


    Actually, for UIStateToggleBtns, you use SetToggleState() and you can pass it either the index of the desired state, or the name of the desired state.


    You can e-mail me directly (please include your order reference number) for now. I'll have a work-around for the Google group fiasco up and running sometime next week (fingers crossed).


    Yes, that sounds like exactly the right solution for your situation.


    Yes, just use mySprite.SetSize(width, height).


    On the fading material issue, that could be because the two panels in question share the same material (though Unity is supposed to "clone" the material in such a case). Though there aren't many other options for fading the color of TextMeshes or non-EZ GUI visual elements, when it comes to controls and sprites, you can use FadeSprite instead which shouldn't experience this problem, and should be faster as well.

    On the scaling/collider issue, this sounds like it might be related to the sprite/control itself being 0 size, meaning the collider is sized to match, and then when it is scaled up, it is still 0 sized. If you would like, e-mail me a sample package of these issues privately and I'll see what I can figure out for you.
     
  43. Kawe

    Kawe

    Joined:
    Dec 3, 2009
    Posts:
    132
    Hey Brady, just wanted to hear if you could share some kind of roadmap for future updates.
     
  44. Imari

    Imari

    Joined:
    May 26, 2010
    Posts:
    24
    Brady, I asked about the book because if you were writing one, I'd most likely buy it. Sometimes it's just good to be able to get away from the monitor and sit cozily in an armchair with a book. :)
     
  45. ibivibiv

    ibivibiv

    Joined:
    Mar 3, 2007
    Posts:
    81
    Woohoo, I am the first member ever on the forum :)

    edit: Ok maybe I'm dense or something but I can't post there now that I am logged in? I can navigate to the various forums, but no "new topic" button in sight?
     
  46. Brady

    Brady

    Joined:
    Sep 25, 2008
    Posts:
    2,321
    Here are some of the features that will be in the next non-beta release:
    * Integrated text
    * Better text boxes
    * Progress arc control (can be used to create progress/health circles/arcs)
    * Many fixes, improvements, and small new features.

    Here are a few features I cannot promise will make it in yet, but hope to work in in the not-too-distant future (and some might possibly make it in to the next release, you never know):
    * Drag-and-drop support
    * Bi-directional scrolling panels, supporting auto grid-layouted controls.
    * Text that can be colored/faded on a per-character basis, using a tagging or escape character system.

    I'm also always open to suggestions. :)


    Sorry about that, some of the forum permissions were messed up. It should be fixed now.
     
  47. Lokken

    Lokken

    Joined:
    Apr 23, 2009
    Posts:
    436
    This should be put up at the top of the list with the rest of the custom text abilities :)
     
  48. Kawe

    Kawe

    Joined:
    Dec 3, 2009
    Posts:
    132
    Really cool list :)

    After drag and drop support I'd prolly be more interested in even better documentation/tutorials.

    Do you have any deadline set for yourself for the next release? Just curious :)
     
  49. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,670
    Kawe:
    Sometime after his son can control his head, but before he learns to say "Daddy!"? (^_^) Don't forget that Brady is a new father!

    (I've edited my post above for the sake of completeness to mention that the UI Items actually need to be on the UILayer for the UICamera camera to render them...)
     
  50. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,670
    I tried posting this on the Forums @ A&Bsoft, but I didn't see it post. Could these be regulated and waiting approval? (Not surprising considering the volume of spam-bots around...)

    Which is from my comments in this thread:
    http://forum.unity3d.com/viewtopic.php?p=351755
     
unityunity