Search Unity

EZ GUI - Powerful, Low draw call GUI solution

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

  1. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,822
    Hello, I have a question about using Prefabs with EZGUI.

    I have created a login popup prefab, that contains a few EZGUI controls and a UIManager.
    I need this popup prefab to be instantiated in several scenes across my application.

    The problem is all my scenes use EZUI too and have a UIManager already in them, so when I instantiate my login prefab, an error is thrown saying there cannot be 2 UIManager's in a scene.

    How do I get around this issue?

    Thanks
     
  2. Brady

    Brady

    Joined:
    Sep 25, 2008
    Posts:
    2,474
    You should only have one UIManager at a time. I would recommend removing the UIManager from the prefab. Is there a specific reason the prefab needs to have its own?
     
  3. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,822
    Well how do I test the prefab in it's own scene if it doesn't have a UIManager?
    Should I just have a UIManager in the scene but not part of the prefab?
     
  4. Brady

    Brady

    Joined:
    Sep 25, 2008
    Posts:
    2,474
    Yes, just test it in a scene that has a UIManager. It doesn't have to be part of the prefab.
     
  5. Crazy Robot

    Crazy Robot

    Joined:
    Apr 18, 2009
    Posts:
    921
    Hey,

    I just brought my project into 4.0, ran the folder restructuring script and installed SM2 1.92 and EZGui 1.0792

    I have some issues with them,

    One - I have a SpriteText component under a UIListItemContainer, that is under a UIPanel, it always ran fine, but now when the UIListItemContainer gets moved to the "Mover" it generates an error:

    Cannot change GameObject hierarchy while activating or deactivating the parent.
    UnityEngine.Transform:set_parent(Transform)
    UIScrollList:Awake() (at Assets/Plugins/EZ/GUI/Controls/UIScrollList.cs:642)
    UnityEngine.GameObject:SetActive(Boolean)
    UIPanelManager:BringIn(UIPanelBase, MENU_DIRECTION) (at Assets/Plugins/EZ/GUI/Management/UIPanelManager.cs:647)
    UIPanelManager:BringIn(String, MENU_DIRECTION) (at Assets/Plugins/EZ/GUI/Management/UIPanelManager.cs:738)
    UIPanelManager:BringIn(String) (at Assets/Plugins/EZ/GUI/Management/UIPanelManager.cs:762)
    Mainmenucont:BringInStory() (at Assets/Scripts/Mainmenu/Mainmenucont.js:743)

    Two - I have UIButtons set up that have an normal, active, hover states with them, when I hover the mouse over a button it highlights normally, but when I take the mouse away from the button it stays highlighted, it should go back to it's normal state.

    Any help would be appreciated.
     
  6. Brady

    Brady

    Joined:
    Sep 25, 2008
    Posts:
    2,474
    I saw your e-mail and am looking into this... Thanks for the report!
     
  7. iosdev

    iosdev

    Joined:
    Sep 15, 2012
    Posts:
    20
    Hi Brady,
    I am using ezgui and sm for my menu and game scene.
    All work perfectly and proper in pc and android device but in ios device my game is crash when load a scene.
    when i delete ez gui panels (with ezscreen placement )in my scene that work perfectly in ios.
    I am using latest version of ezgui.
    please help me about this problem.
     
  8. Crazy Robot

    Crazy Robot

    Joined:
    Apr 18, 2009
    Posts:
    921
    Do you have any of the EZGui/SM2 objects set as static with batching turned on? With my project I can't have any EZGui or SM2 marked as static with batching on. The game worked find in the editor but when you build it on the device it crashes when the scene loads. I would make sure all of the EZGui/SM2 objects are not set to static then rebuild and try that.
     
  9. Brady

    Brady

    Joined:
    Sep 25, 2008
    Posts:
    2,474
    @iosdev
    Please see my above reply to Imroz Mansuri and let me know if that helps. Regarding static, EZ GUI and SM2 must be able to modify the geometry of the sprite-based objects at runtime, and therefore cannot be static.
     
  10. rakesh12

    rakesh12

    Joined:
    Aug 11, 2012
    Posts:
    3
    Hey,
    I need ezgui tutorial pdf , not a video tutorial,can u suggest site so that i can read EZGUI..
     
  11. iosdev

    iosdev

    Joined:
    Sep 15, 2012
    Posts:
    20
    hey Brady,
    My problem solved in ipad devices,but in ipod is still crash and give me gdb error in debug.
    All scene work perfectly where ez gui tool is not used.
    Please help me..
     
  12. Brady

    Brady

    Joined:
    Sep 25, 2008
    Posts:
    2,474
    Please verify you're using EZ GUI 1.0793 which is the latest version and addresses a possible memory issue when animating objects at the time of a load scene.

    If that does not help, can you verify that merely using an EZScreenPlacement component, apart from anything else, is what is causing the problem? Other than that, I don't have enough information about the issue to be able to troubleshoot it.
     
  13. iosdev

    iosdev

    Joined:
    Sep 15, 2012
    Posts:
    20
    Hello Brady,
    My problem solved in ipad and ipod.
    just remove SimpleSprite and all scene run smoothly.
    Thanks brady...
     
  14. Martin-Schultz

    Martin-Schultz

    Joined:
    Jan 10, 2006
    Posts:
    1,377
    @Brady / @CrazyRobot:

    Have you found a fix for the "Cannot change GameObject hierarchy while activating or deactivating the parent."?`

    It happens to me also after upgrading to 4.0 and it happens in UIScrollList.cs in Awake, in this line:

    mover.transform.parent = transform;

    Any clue how to solve this?
     
  15. Brady

    Brady

    Joined:
    Sep 25, 2008
    Posts:
    2,474
    Yes, I've got a fix I'd like both of you to test for me and let me know if it addresses your issue. Check your e-mail and please let me know as soon as possible so I can roll this fix into the next release. Thanks!
     
  16. Crazy Robot

    Crazy Robot

    Joined:
    Apr 18, 2009
    Posts:
    921
    Sorry it took a bit, I've been swamped, but that code change fixed the issue on my end.

    I also sent you additional info on the list issue.
     
  17. bpritchard

    bpritchard

    Joined:
    Jan 29, 2009
    Posts:
    444
    @Brady,

    Where can i find v1.0793? The files on the Update link on your site are pointing to 1.0792 still.

    Cheers
    Bryan
     
    Last edited: Oct 4, 2012
  18. pha

    pha

    Joined:
    Oct 23, 2012
    Posts:
    20
    What do I need to do in order to have my game level load when I click on "Start Game" button using ezgui?

    Thank you,
     
  19. Brady

    Brady

    Joined:
    Sep 25, 2008
    Posts:
    2,474
    @bpritchard
    I checked and it is linked to 1.0793. Maybe try clearing your browser cache?


    @pha
    The easiest way is to just use a UIBtnLoadScene component for the button, and then just enter the name of the scene you wish to load in the "Scene" field. That's all you have to do. Just make sure that the scene is added to your scenes list in Build Settings as Unity won't let you load a scene that hasn't been added to that.
     
  20. pha

    pha

    Joined:
    Oct 23, 2012
    Posts:
    20
    Thank you so much, Brady! I didn't realize that button is supported in ezgui.
     
  21. Crazy Robot

    Crazy Robot

    Joined:
    Apr 18, 2009
    Posts:
    921
    Hey Brady,

    I have the latest EZGUI and SM2 installed,

    When I leave a scene and load a new one, I get the following Null Reference Exceptions:

    and

    This only happens on an iPhone 5, and in the editor when iPhone resolution is selected. This completely crashes the device.

    Unity 3.5.6f4

    Mac Lion
     
  22. Brady

    Brady

    Joined:
    Sep 25, 2008
    Posts:
    2,474
    I believe I have a fix for this issue that I'm rolling into the next update release. If you like, e-mail me directly and I'll send you the internal version for you to test. Thanks!
     
  23. tnaseem

    tnaseem

    Joined:
    Oct 23, 2009
    Posts:
    149
    Sorry for cross posting here and on the EZ GUI forums, but a little desperate for a quick answer. If I can't get it to work, I'll just hop back to Unity 3.5...

    Full question is here: http://forum.anbsoft.com/viewtopic.php?f=10&t=4533

    To summarise: In Unity 4.0, when the panels are initially disabled, the 'control_text' object of a button isn't enabled along with the other objects within the panel, when the panel becomes active. My question in the link above will make more sense, if this doesn't!
     
  24. Brady

    Brady

    Joined:
    Sep 25, 2008
    Posts:
    2,474
    Thanks for the follow-up, tnaseem, please see my reply on the forum. Thanks again!
     
  25. DARK_ETERNAL

    DARK_ETERNAL

    Joined:
    May 9, 2012
    Posts:
    41
    Greetings, Brady.

    I opened a thread with a question, but since no one seems to have read it, and I found this that seems to be the 'official' EZGUI thread, I'll ask here.

    I've had some issues with EZGUI and Unity 4 while deactivating panel contents using the Deactivate All on Dismiss check. It works as intended, but when I bring in the panel, some of the contents won't be enabled again. I'm populating my list with instances of a prefab, so I checked if that prefab's contents were deactivated, but they aren't. In previous versions of Unity it seems to work properly.

    Using EZGUI 1.0793. Any pointers?

    Thanks in advance.
     
  26. Brady

    Brady

    Joined:
    Sep 25, 2008
    Posts:
    2,474
    I believe the issue in question is addressed by the 1.0794 update. Let me know if that doesn't resolve it.
     
  27. poolts

    poolts

    Joined:
    Aug 9, 2012
    Posts:
    113
    Hey guys,

    Just got the latest version of EZ GUI (v1.0794) and when the character spacing is set to 1, it's huge! Although when set to 0.99 or 1.01 it's normal. Any ideas why this might be happening?

    I'm going to hunt through the code and see if I can track it down, will repost if I find anything. Brady help :D
     
  28. Brady

    Brady

    Joined:
    Sep 25, 2008
    Posts:
    2,474
    There were some changes in an effort to solve centering issues when the character spacing is not equal to 1.0, everything was working in my tests, so I'm not trying to figure out what may be going on as I've received a couple of reports like yours. If you could e-mail me directly with a simple repro package, that would help too. Thanks!
     
  29. DARK_ETERNAL

    DARK_ETERNAL

    Joined:
    May 9, 2012
    Posts:
    41
    I updated to 1.0794 and I got the same huge spacing poolts is mentioning. The panel issue seems to be resolved, but now, this spacing issue.
     
  30. Brady

    Brady

    Joined:
    Sep 25, 2008
    Posts:
    2,474
    I'm working on getting out another release that will address the spacing issue as soon as possible. For now, an approximate work-around can be to use a character spacing of 0.999.
     
  31. poolts

    poolts

    Joined:
    Aug 9, 2012
    Posts:
    113
    Hi Brady. Without trying to sound pushy, what's the ETA on the spacing fix? I'd be happy to test an internal version, and give feedback.

    Cheers, Alex.
     
  32. Brady

    Brady

    Joined:
    Sep 25, 2008
    Posts:
    2,474
    I'm hoping to have it up on the updates page by sometime tomorrow, fingers crossed.
     
  33. poolts

    poolts

    Joined:
    Aug 9, 2012
    Posts:
    113
    Awesome, can confirm from testing that the spacing issue is fixed. Cheers, Brady.
     
  34. Poupi

    Poupi

    Joined:
    Jan 11, 2012
    Posts:
    111
    Is there a way to justify the text of a SpriteText ?
     
  35. Foxxis

    Foxxis

    Joined:
    Jun 27, 2006
    Posts:
    1,108
    There doesn't seem to be much activity here or on the official forums? Is this product still supported?

    Since upgrading to Unity 4.0.1 we are having severe problems with crashes on iOS devices, all traced back to UIScrollList. Anyone else had similar problems...?

    TIA!
     
  36. Brady

    Brady

    Joined:
    Sep 25, 2008
    Posts:
    2,474
    It is fully supported, and I'm pretty sure I replied to your thread yesterday. I've not seen this problem myself. I'm thinking it has to do with the point at which you are adding or removing elements from the list, but I'll have to get more detailed information about your circumstances to know more. If I recall correctly, you were calling RepositionItems(), yes? If so, I need to know exactly what you did just prior to calling it, and if/when you are removing any elements from the list.
     
  37. Foxxis

    Foxxis

    Joined:
    Jun 27, 2006
    Posts:
    1,108
    Thanks for your reply!

    No, you there has been no reply in the forums to the three posts I submitted about different issues. Regarding the order of calls, it doesn't have to be preceded by anything. For example, we have a simple UIScollList driving a text in a clipped area (like a TV newsfeed scroll). It's already set up in the scene and the only thing we do in code are setting some offset parameters and then calling repositionItems. That call crashes the device.
    In another instance we add an itemcontainer with three packedsprites to the list and call repositionitems -> crash. Adding the container first and then adding the packed sprites to the container with AddItem also causes a crash. Everything playes fine in the editor though. Disabling UIScrollLists eliminates all device crashes.

    Since you sent me an email we can continue contact in that way if you would like. Either is fine by me.
     
  38. tonemcbride

    tonemcbride

    Joined:
    Sep 7, 2010
    Posts:
    1,089
    Hi,

    I found some code by 'akutruff' on the forums that found inactive objects (by using the Unity selection system as a filter) and added it to the 'FindPackableSprites' function in the Build Atlas file. It seems to work well and builds atlases using all the buttons in the scene rather than just the active ones - I often have disabled buttons in the scene that the atlas generation misses.

    I've put the code below but it's just a quick hack so you might want to fix it up to work with all types of EZGui types - I think it would be useful to have as a part of EZGui.

    Thanks,
    Tony

    Code (csharp):
    1. // Start of file
    2. using System.Linq;
    3.  

    Code (csharp):
    1.     Transform[] GetAllDisabledSceneObjects()
    2.     {
    3.         var allTransforms = GameObject.FindObjectsOfTypeAll(typeof(Transform));
    4.  
    5.         var previousSelection = Selection.objects;
    6.  
    7.         Selection.objects = allTransforms.Cast<Transform>()
    8.             .Where(x => x != null )
    9.             .Select(x => x.gameObject)
    10.             .Where(x => x != null  !x.active)
    11.             .Cast<UnityEngine.Object>().ToArray();
    12.        
    13.         var selectedTransforms = Selection.GetTransforms( SelectionMode.Editable | SelectionMode.ExcludePrefab);
    14.  
    15.         Selection.objects = previousSelection;
    16.        
    17.         return selectedTransforms;
    18.     }  
    19.  
    20.     // Finds all packable sprite objects:
    21.     void FindPackableSprites(ArrayList sprites)
    22.     {
    23.         List<Object> objList = new List<Object>();
    24.  
    25.         // Get all packed sprites in the scene:
    26.         Object[] o = FindObjectsOfType(typeof(AutoSpriteBase));
    27.         objList.AddRange(o);
    28.        
    29.         // Get disabled objects in the scene
    30.         Transform[] disabledObjects = GetAllDisabledSceneObjects();
    31.        
    32.         // Add them to our list if they're AutoSpriteBase type
    33.         foreach( Transform disabledObject in disabledObjects )
    34.         {
    35.             if( disabledObject.gameObject.GetComponent( typeof( AutoSpriteBase ) ) != null )
    36.             {
    37.                 if( disabledObject.gameObject.GetComponent( typeof( UIButton ) ) != null )
    38.                     objList.Add( disabledObject.gameObject.GetComponent( typeof( UIButton ) ) as UIButton );
    39.                 if( disabledObject.gameObject.GetComponent( typeof( UISlider ) ) != null )
    40.                     objList.Add( disabledObject.gameObject.GetComponent( typeof( UISlider ) ) as UISlider );
    41.                 if( disabledObject.gameObject.GetComponent( typeof( PackedSprite ) ) != null )
    42.                     objList.Add( disabledObject.gameObject.GetComponent( typeof( PackedSprite ) ) as PackedSprite );
    43.                 if( disabledObject.gameObject.GetComponent( typeof( UIStateToggleBtn ) ) != null )
    44.                     objList.Add( disabledObject.gameObject.GetComponent( typeof( UIStateToggleBtn ) ) as UIStateToggleBtn );
    45.             }
    46.         }
    47.  
     
    Last edited: Mar 20, 2013
  39. Brady

    Brady

    Joined:
    Sep 25, 2008
    Posts:
    2,474
    Thanks, tonemcbride! That's a creative approach.
     
    Last edited: Mar 20, 2013
  40. Brady

    Brady

    Joined:
    Sep 25, 2008
    Posts:
    2,474
    Unfortunately, it relies on a deprecated API. Given how useful that deprecated method is, I'd have thought it would have an equivalent replacement.
     
  41. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,697
    Hi Brady,
    I am using an input delegate on a button which controls player movement. My concern is that, when I put a second finger down, this new position, from this new finger takes over, as the required inputPos.

    Why is a UIButton, reading another finger, which whose touch was not initiated by this button. But rather, somewhere else on screen?

    Code (csharp):
    1.  
    2.     void MyDelegate(ref POINTER_INFO ptr)
    3.     {
    4.        // Display a message in the console if
    5.        // the pointer is dragged over the control:
    6.        if(ptr.evt == POINTER_INFO.INPUT_EVENT.DRAG){
    7.             Debug.Log("drag " + Time.deltaTime);
    8.             inputPos =  ptr.devicePos;
    9.             if(!brainIsMoving)
    10.                 brainIsMoving = true;
    11.                 InvokeRepeating("MoveBrain", 0.1f, 0.1f);
    12.                 }
    13.        
    14.         else if(ptr.evt == POINTER_INFO.INPUT_EVENT.MOVE_OFF){
    15.             Debug.Log("%%%%%%%%%%%Move Off + " + Time.time);
    16.             CancelInvoke("MoveBrain");
    17.             brainIsMoving = false;
    18.             InvokeRepeating("HaltBrain", 0.01f, 0.3F); 
    19.         }  
    20.         else if(ptr.evt == POINTER_INFO.INPUT_EVENT.RELEASE_OFF){
    21.             Debug.Log("XXXXXXXXXXXXXreleaseOff " + Time.deltaTime);
    22.             CancelInvoke("MoveBrain");
    23.             brainIsMoving = false;
    24.             InvokeRepeating("HaltBrain", 0.01f, 0.3F);
    25.             }
    26.         else if(ptr.evt == POINTER_INFO.INPUT_EVENT.RELEASE){
    27.             Debug.Log("iiiiiiiiiiiirelease " + Time.deltaTime);
    28.             CancelInvoke("MoveBrain");
    29.             brainIsMoving = false;
    30.             InvokeRepeating("HaltBrain", 0.01f, 0.3F);
    31.             }  
    32.    
    33.     }
    34.  
     
  42. Brady

    Brady

    Joined:
    Sep 25, 2008
    Posts:
    2,474
    Have you registered the same delegate for more than one button? That's the only reason why a second touch on a different button would show up in the same delegate.
     
  43. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,697
    Hi Brady,
    (I got the above working.)
    I have an animation that doubles in size at Start(). It is not Pixel Perfect but it does have auto resize. The scale is the same after start, it is the width and height that are the culprit. Why might this be occurring?
     
  44. Brady

    Brady

    Joined:
    Sep 25, 2008
    Posts:
    2,474
    Make sure you are using .SetSize() and not merely changing the width and height members. If that isn't the issue, it could be that since you are doing it in Start(), if the sprite's own Start() hasn't run yet, then it may not be initialized. Try yielding to the end of the frame (so that all the other Start()s have finished running) and then doing the size change.
     
  45. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,697
    I am not adjusting the size in code in anyway. It is just happening.

    :?
     
  46. Brady

    Brady

    Joined:
    Sep 25, 2008
    Posts:
    2,474
    I'm not sure then. It should automatically resize of auto-resize is enabled, provided the dimensions of the image actually change. You would probably need to privately e-mail me a sample scene that reproduces the issue to diagnose it further.
     
  47. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,697
    Hi Brady,
    I know we went over this before, but I can not find the thread. How, if at all, can I add a ListItem to a ScrollList after Start();?
     
  48. Brady

    Brady

    Joined:
    Sep 25, 2008
    Posts:
    2,474
    To ensure it's after Start(), you could put a yield statement in the Start() of one of your scripts just before the line where you add the item. In JS it would look like:
    Code (csharp):
    1.  
    2. function Start()
    3. {
    4.    // stuff goes here...
    5.  
    6.    // Wait to the end of the frame:
    7.    yield;
    8.  
    9.    // Now add items:
    10.    myScrollList.AddItem(...);
    11. }
    12.  
    C# would look like:
    Code (csharp):
    1.  
    2. IEnumerator Start()
    3. {
    4.    // stuff goes here...
    5.  
    6.    // Wait to the end of the frame:
    7.    yield return null;
    8.  
    9.    // Now add items:
    10.    myScrollList.AddItem(...);
    11. }
    12.  
     
  49. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,697
  50. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,697
    Hi Brady,
    I can not find the documentation on AddItem(), or I am assuming, RemoveItem().

    Can you provide a link for these pages, if they exist (maybe just C#). Also, my goal is to have a scrollList with several items. I would like to tap one item, and have that item removed. As a side bonus, I would like the remaining items to "come together". Meaning, they move towards each other to fill in the gap.

    Can you help me with this? Should I just email you??
    Thanks