Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

EZ GUI - Powerful, Low draw call GUI solution

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

  1. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,664
    You should read up on the docs about the built in transitions. These are more seamless than trying to mix EZG and iTween.

    Go to the root page in your documentation (included in your EZG download) and click on "transitions":
     
  2. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,697
    Great,
    thanks I had only previously discovered, used the class pages.
    Thank you.
     
  3. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,697
    Hi the boards are very slow so I will post here,
    hopefully someone can help me.

    I Have a interactive panel,
    I have a change panel btn
    I click the btn, it brings in the panel.
    Problem: If I move the mouse inside the panel, it repeats the initial, forwrd, in action. It does what the changePanel btn does. ... not cool.
     
  4. khaosenygma

    khaosenygma

    Joined:
    May 5, 2011
    Posts:
    27
    Has anyone had an issue with EZGUI where the drawcalls for a set of objects that all share a sprite atlas is still really high? we think its got something to do with the scaling of the different objects. can anyone shed some light on this?
     
  5. Nikovich

    Nikovich

    Joined:
    Jul 10, 2010
    Posts:
    69
    I'm having trouble getting the ending delegate to work. I know I have to pass it some kind of reference to EZAnimation but I can't seem to find what that should be. C# is new to me.

    Code (csharp):
    1.     void AnimTitleOut (UIPanel animMe) {
    2.         GameObject tempObj = animMe.gameObject;
    3.         AnimatePosition.Do(tempObj,                                                     // Game Object to animate
    4.         EZAnimation.ANIM_MODE.To,                                                       // Animate "by" a certain amount
    5.         new Vector3(-267, animMe.transform.position.y, animMe.transform.position.z),    // A Vector3 containing the angles to rotate in each axis
    6.         EZAnimation.quinticOut,                                                         // The easing function to use
    7.         0.7f,                                                                           // duration of effect, in seconds - negative value means repeat infinitely
    8.         0,                                                                              // delay before applying effect, in seconds
    9.         null,                                                                           // no starting delegate
    10.         PanelsIn);                                                                      // Ending delegate
    11.     }
    12.    
    13.     void PanelsIn () {
    14.         // Unarents new WorldMenu Object, deactivates old WorldMenu Object, animates new WorldMenu Object pieces
    15.         worldMenus[currWorld].myGameObject.transform.parent = myPanelManager.gameObject.transform;
    16.         titleScreen.gameObject.SetActiveRecursively(false);
    17.         worldMenus[currWorld].animAll("forwards");
    18.     }

    EDIT: Ueeghy. I didn't even have to pass something to the method or even use the variable. Just had to declare the method so that it could accept it.

    Code (csharp):
    1. void PanelsIn (EZAnimation anim) {
    2.  
    3. }
    4.  
     
    Last edited: Mar 28, 2012
  6. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,697
    I want to make a menu system like that of the iPhone. So, what that means, is, the default any iDevice menu where you can swipe a page (group of apps) to the next page. The page brought in always locks into the middle.

    I have tried this with the Scroll List and List Items but to no luck.

    I built a trigger, that would sit in the center of the screen. The idea was that the trigger would in entered by any List Item, pull the item (via iTween.MoveTo()) into the center of the screen. This does not work mainly because it seems that in the Scroll List I am not per say moving the items about. They are all in cased in a new "Move" folder. I tied to do it by moving the parent move folder, but it causes abnormal visual effects.

    So, how can I use EZGUI to create this type of menu?
     
    Last edited: Apr 5, 2012
  7. Brady

    Brady

    Joined:
    Sep 25, 2008
    Posts:
    2,474
    @khaosenygma
    Scaling will cause an object not to batch, if its scale doesn't exactly match the other objects with which it is intended to batch. See the troubleshooting section of the EZ GUI docs for more info on batching.


    @renman3000
    See your e-mail.
     
  8. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,697
    Yes.
    Thanks again Brady.
     
  9. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,697
    HI there,
    I am just starting out with Scroll Lists.
    I am wondering, Scroll Lists have the ability to Invoke A Method. I selected an object and its script + the function to invoke. However, I get no response when I drag, scroll in the list. How is the method invoked?
     
    Last edited: Apr 5, 2012
  10. Brady

    Brady

    Joined:
    Sep 25, 2008
    Posts:
    2,474
    The scroll list itself will only invoke a method when a UIListItem is *selected*. If you are using a UIListButton or a UIListItemCOntainer that contains other controls, then you need to register your delegate or method to invoke with the control/item itself. The exception to this is that the scroll list will invoke a method when one of these other item types is clicked, but the item interacted with will be stored in the scroll list's "LastClickedControl" property.
     
  11. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,697
    So any child of the List Item, will when clicked use the Scroll Lists, method to Invoke?
     
  12. Brady

    Brady

    Joined:
    Sep 25, 2008
    Posts:
    2,474
    If memory serves, yes, it should trigger the invoke as well as the value changed delegate.
     
  13. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,697
    So the best way to have a iPhone type menu system is with Scroll List, List Items and btns of some type as children of the List Items?
     
  14. Brady

    Brady

    Joined:
    Sep 25, 2008
    Posts:
    2,474
  15. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,697
    Great.
    Thank you.
     
  16. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,697
    Edit.
    Solved.
     
    Last edited: Apr 13, 2012
  17. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,697
    HI there,
    I had a UIButton which was working, could be seen etc. However I changed the material and atlas. Now I can see the item in the editor however I can not see it in game play. The camera is set, the material is set etc.

    Any reasoning?
    Edit: I just replaced the objects all together and it has gotten rid of the issue.
     
    Last edited: Apr 17, 2012
  18. khaosenygma

    khaosenygma

    Joined:
    May 5, 2011
    Posts:
    27
    EZGUI is acting strange between platforms. On IOS it behaves normally, and positions properly. but when we build to android. The GUI doesnt respond till the scene is reloaded. the first run of the application doesnt position the GUI properly. Any idea why?
     
  19. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,697
    Is there a way to reset the animations of an object?

    In my case I am referencing UIButtons. I have a simple two frame toggle. Kind of like a blinking effect. I have 3 of these objects and they seem to fall out of sequence with each other.
     
  20. adam718

    adam718

    Joined:
    Mar 11, 2012
    Posts:
    58
    Hi!
    First of all, I'd like to thank you for your wonderful article.

    I am from asia and I'm wondering if ezgui support cjk font for spritetext?
    As you know korean can not be in one texture and at least 2~3 textures.
    I hope you solve this problem.

    Best Regards,
    Thank you,
    Adam.
     
  21. khaosenygma

    khaosenygma

    Joined:
    May 5, 2011
    Posts:
    27
    Figured out my own problem. We needed to reiterate through all the gameobjects that were using the EZScreenPlacement.cs and recall the PositionOnScreenRecursively() function to get it to appear on start up
     
  22. Brady

    Brady

    Joined:
    Sep 25, 2008
    Posts:
    2,474
    First, please remember that the offical forum is normally a better place to get your questions answered: forum.anbsoft.com.

    @renman3000
    I'm not entirely sure I know what you're referring to. Are you referring to EZAnimation animations (including transitions setup in the EZ GUI inspector), or are you referring to sprite-based (frame-by-frame) animations? And as for them falling out of synch, what are you doing to keep them in synch, are you starting them at exactly the same time?


    @AdamWorld
    Unfortunately, multi-textured fonts are not currently supported with EZ GUI's SpriteText object. However, you can still intermingle Unity's 3D Text/TextMesh with EZ GUI. It just doesn't support features like clipping, automatic line wrapping, or text fields.
     
  23. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,697
    Hi Brady,
    I am using UIButtons. I have 3 instances of an identical class. Each uses 2 frames (animation) for each state, over, active etc looping infinitely. The issue is, I can call all of them to appear at once and would like the blinking animation to be in synch between them. The problem is caused when i tap one. This causes that button to fall out of synch with the rest. Unless i tap it at the exact frame of the loop completion, the button now blinks out of step with the other two.

    Is there a way to reset each btn to normal state in the exact same frame without actually tapping them?

    Edit: possible solution.
    Is there a way that when i tap a button that it does not switch back to normal until one second, the length of the animation is completed?
     
    Last edited: Apr 19, 2012
  24. Brady

    Brady

    Joined:
    Sep 25, 2008
    Posts:
    2,474
    It would be easier to just set the other buttons to a state matching the one that was tapped than to delay the button that was tapped. To do this, just call the other buttons' .SetControlState() and pass in the state you want, such as UIButton.CONTROL_STATE.ACTIVE, etc.
     
  25. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,697
    Hmm.
    Great.
    Thanks.
     
  26. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,697
    Hi Brady,
    I just put in...
    btnData.CONTROL_STATE.ACTIVE;


    where btnData is the component of the UIButton. But I get this error.




    BCE0034: Expressions in statements must only be executed for their side-effects.
     
  27. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,697
    Another question,
    I want to pause my game via pause btn. And I want pause btn to pull up a panel. I already have this, but what I then want is a ScrollList to exist inside that panel. My fear, pre build is that if TimeScale = 0. The mover of thew scroll list will not be able to move.

    Is timeScale the only way to pause a game? Is there an alternative? Do you have any suggestions for my situation?
     
  28. Brady

    Brady

    Joined:
    Sep 25, 2008
    Posts:
    2,474
    That syntax is incorrect. CONTROL_STATE.ACTIVE is an enum that is inside the UIButton namespace, so the correct, full-qualified syntax is:

    UIButton.CONTROL_STATE.ACTIVE


    Regarding your second question, EZ GUI uses realtime by default for its animations specifically because of this. Otherwise, pause menus wouldn't work.
     
  29. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,697
    Thanks Brady,
    Another quick question.

    Is there a quick way to have a scroll list, where the object, in this case button, is scaled up in size, while the other list items, in the periphery are scaled down, to create the illusion, of depth? Something similar to Apples menu bar on the desktop.
     
  30. Brady

    Brady

    Joined:
    Sep 25, 2008
    Posts:
    2,474
    Yes, just setup a scale transition element for the active state of the button.
     
  31. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,697
    What i am thinking tho is...

    Say i have a scroll list with a dozen items.
    Only 3 can be seen at any one time.
    I want the middle item to be enlarged.


    Edit.
    My own solution would be to have a trigger to scale up that item.
     
    Last edited: Apr 24, 2012
  32. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,697
    Hi Brady,
    Is there a way that a scroll list can drag on both the x and y axis?
    The idea is to create a minimap, so i would only have a single item list.


    On a side note, I just attempted to build a scroll list but am getting the error...
    ArgumentOutOfRangeException: Argument is out of range.
    Parameter name: index

    ...Not sure why or what to do.



    Also, if my pause menu, will potentially have several scroll lists. Should I be disabling them when not in use? If so, how?






    Thanks.
    Ren
     
    Last edited: Apr 24, 2012
  33. Brady

    Brady

    Joined:
    Sep 25, 2008
    Posts:
    2,474
    There is not a built-in way to do both X and Y dragging simultaneously. However, see the official forum for some user-created solutions for this. I know it's been done before and I think they left explanations for how they did it.

    Regarding the out of range error, I just received another report of that recently and am looking into it.

    You can disable everything in a GameObject's hierarchy by using .SetActiveRecursively(false).
     
  34. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,697
    Thank you.
     
  35. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,697
    Hi Brady,
    Is there a way to dynamically swap the drag type (vertical, to horizontal and or vice versa)? If I know my drag direction I can swap. Bit of a sloppy, jagged solution. Also, if there is, then that, perhaps is where I should look to alter the code.

    Any ideas?
     
  36. Brady

    Brady

    Joined:
    Sep 25, 2008
    Posts:
    2,474
    No, not really, because the direction also determines how the items are laid out. So changing the direction will change the item layout. For something like a minimap, I'd probably instead just use something like a UIInteractivePanel with certain bounds defined, and then render it using a separate dedicated camera that uses a viewport rect to just render to a certain portion of the screen. See the Unity docs regarding the Camera component and viewport rects.
     
  37. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,697
    Hmm. I guess that could work.


    Thanks!
     
  38. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,697
    Hi Brady,

    is there a way I can lock the position of the scroll list. Meaning, I know I can use snap. That works great if I want my desired item to be in the middle of the list. But what if I want the item to center, off center. Say off to the right by 10 units?
     
    Last edited: Apr 25, 2012
  39. cupsster

    cupsster

    Joined:
    Apr 14, 2009
    Posts:
    363
    Hi Brady,
    Q1: I would like to ask if this GUI solution can produce text that is curved like vinette (sticker) on the bottle. If so can you give me some hint or example of how complicated this would be to implement? My main problem is that this text need to be placed in scene in which camera moves and there are other objects that can cover tis text, partially or as whole. On top of that some objects (quite lot of them) are transparent. If I read it right, use of dedicated Layer and Camera would cause problems for me because it will force my (curved or not) GUI objects to be drawn in front of geometry.

    TY
     
    Last edited: Apr 29, 2012
  40. cryoknight

    cryoknight

    Joined:
    May 2, 2012
    Posts:
    3
    Hi Brady!

    Would it be possible to build a function to create sprite atlases for a particular material in code (and NOT for everything in the scene)?
    Reason being, it slows down the art pipeline tremendously to have to manually create a sprite atlas for every object. For certain reasons we need to build 1 sprite atlas per art asset for a specific part of the game, and I wrote code to automatically build the prefabs, assign materials, etc, when new art is added to the game. However, I still have to go in and build each individual sprite atlas.

    If this could be done in code, I could automate the entire process, and shave a lot of time off of asset importing.
     
  41. Brady

    Brady

    Joined:
    Sep 25, 2008
    Posts:
    2,474
    @renman3000
    I'm not sure what you mean. Have you looked at the alignment setting?


    @cupsster
    I'm not sure I fully grasp what you're describing. The text objects are like Unity's 3DText - they are 3D objects in the game world. However, they are not curved, they are coplanar. They can be rotated, etc, in any direction in 3D space, but a given string of text will be coplanar, not curved, if that answers your question.


    @cryoknight
    I'm not sure I understand what you're wanting to do 100%. First, having a separate material for each object kind of defeats a big part of the purpose and performance savings of having a GUI that can batch. In order to batch, objects must share materials. If that's not an option for some reason, then if your question is if you can build an atlas for an individual material, rather than for everything every time, yes. Just select the material in question, and go to Tools->A&B Software->Build Atlas For Material. Or you can click the "gear" icon in the material's inspector pane and choose "Build Atlas". This will only build the atlas for that given material - and you can also do multiple materials by selecting more than one at a time. If, however, you want this ability, as well as the ability to automate it entirely via an editor script, yes, you could definitely do that. I'd recommend having a look at the BuildAtlases.cs script, and see the logic path it takes when only a specific material, or materials, are being built. Then just invoke that code (or duplicate it into your own editor script) in a case where you have automatically generated a new material.
     
  42. cryoknight

    cryoknight

    Joined:
    May 2, 2012
    Posts:
    3
    Cool, thanks! I'll check out the BuildAtlases.cs script.
     
  43. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,697
    Hi Brady,
    I have an issue with the sprites called via UIButton, with the material being one of several images (atlas, built). My button, publishes an image, at pixel perfect, at scale 1,1,1 to be stretched horizontally. I suspect it is the atlas it self which has distorted the images. Any ideas?
     
    Last edited: May 4, 2012
  44. Brady

    Brady

    Joined:
    Sep 25, 2008
    Posts:
    2,474
    See the troubleshooting section of the docs. This is probably being caused by Unity resizing your atlas to be square because you have it set to be compressed.
     
  45. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,697
    Edit.
    Solved.
    Thanks.
     
    Last edited: May 5, 2012
  46. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,697
    Hi Brady,
    Another question.
    I have a parent, which holds several buttons. The parent itself is an image. I want pixel perfect applied to it, so I added a UIButton to it. The child UIButtons are positioned in it in such a manner. However, when I run the game, the buttons, are almost pushed out of the positions they were in.

    Semi confused. There are no colliders or rigidbodies of any kind on them. They are simply UIButtons. Children of a UIButton.


    Have you ever heard of this before? Any suggestions?
     
  47. Brady

    Brady

    Joined:
    Sep 25, 2008
    Posts:
    2,474
    I'm not able to picture what you're describing. Do the buttons have EZScreenPlacement components on them? If so, disable "Allow Transform Drag".
     
  48. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,697
    Each object displaced is a UIButton. Each is a child of the instance bkgPause. bkgPause has a UIButton, only to achieve pixel perfect. Nothing else, the UIButton component serves only to generate pixel perfect on bkgPause

    In the editor, the bkgPause, and its children are arranged, positionally, how I like. At run time the children are out of position.




    And I checked the component UIButton for the option, "Allow Transform Drag". But I saw no such option.


    ???
     
  49. Brady

    Brady

    Joined:
    Sep 25, 2008
    Posts:
    2,474
    Realize that when pixel-perfect is enabled, then depending on the resolution, the world-space size of an object will vary, potentially causing it to seem to have been repositioned relative to other objects around it. But in actuality, the transform position is the same, it is just a different world size. That's what pixel-perfect does - it changes the world size of the object so that it displays 1:1, pixel-for-pixel on-screen.
     
  50. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,697
    I imported the images, for my pause screen at pixel size in illustrator, for ipad dimensions 1024x768(?) anyhow, they fit perfectly size wise. Proportioned perfectly. However the relative position of children to parent, changes at run time. It looks like each child is repositioned x units to the right.... If i would have to guess i would say 200 pixels.


    Wierd.