Search Unity

EZ GUI - Powerful, Low draw call GUI solution

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

  1. John-B

    John-B

    Joined:
    Nov 14, 2009
    Posts:
    1,262
    FYI, I've just been in the process of updating several (34) old iOS apps that Apple has said must be updated. I last worked on these apps in 2013. I'd wanted to convert them to Unity UI, but there's too many apps and too little time. So I just wanted to share some of the issues I've found with EZGUI, and what you need to do to make it work in Unity 5.x. Generally speaking, it works just fine, no major problems.

    If the project is really old, update to Unity 4.x before updating to 5.x. Updating some of the older projects directly into 5.x pretty much wiped out everything EZGUI related, I'd have had to essentially start over with the EZGUI stuff.

    Turn OFF pixel perfect on EVERYTHING. It draws everything half size on a retina display now.

    Don't use the old Vertex Colored shader for text, use Vertex Colored, Fast. That makes text look way better now, though still worse than I remember it looking.

    Delete the file TextHider if it's still hanging around from an old version.

    There's an error in UISlider at line 349. I had to comment out that line to get it to build. Sliders still work. //knob.animations[3].SetAnim(states[5], 3);

    UIManager.instance.DidPointerHitUI(0) doesn't seem to work any more.

    There's one error that I can't do anything about in UIManager and EZAnimator: `UnityEngine.Application.LoadLevel(string)' is obsolete: `Use SceneManager.LoadScene'. This is not a quick fix, so with no updates, I'm guessing EZGUI will stop working when this function is no longer supported.
     
    Last edited: Oct 12, 2016
  2. spacefrog

    spacefrog

    Joined:
    Jun 14, 2009
    Posts:
    734
    Thanks for the response guys ... great to hear that there are generally no huge issues
    Already feel home again in my old projects and Unity in general ( after 1yr absence coding anything in/for Unity)
    Thanks John-B for the very detailed list...
     
  3. John-B

    John-B

    Joined:
    Nov 14, 2009
    Posts:
    1,262
    One other thing I just discovered when updating some old Web Player apps for WebGL: It looks like print and debug statements can cause an "incorrect header check" error in WebGL (http://answers.unity3d.com/questions/1156260/webgl-incorrect-header-check.html). When I went through all the EZGUI files and commented out all debug statements, the error went away. At the same time, I also got rid of some SetActiveRecursively calls in my code, but I'm pretty sure it was the debug statements that were the problem.
     
  4. John-B

    John-B

    Joined:
    Nov 14, 2009
    Posts:
    1,262
    I just updated an old project to Unity 2017.2.0f3, and there are now some problems with EZGUI. The first time I ran it after the update, I got a null reference exception at the following line of SpriteFont.cs (line 2):

    Code (CSharp):
    1. #if UNITY_IPHONE && !(UNITY_3_0 || UNITY_3_1 || UNITY_3_2 || UNITY_3_3 || UNITY_3_4 || UNITY_3_5 || UNITY_3_6 || UNITY_3_7 || UNITY_3_8 || UNITY_3_9 || UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_4_7 || UNITY_4_8 || UNITY_4_9 || UNITY_5_0 || UNITY_5_1 || UNITY_5_2 || UNITY_5_3 || UNITY_5_4 || UNITY_5_5 || UNITY_5_6 || UNITY_5_7 || UNITY_5_8 || UNITY_5_9)
    2.  chars[i].kernings[keys[j]] = (object) (((float)chars[i].origKernings[keys[j]]) * charSpacing);
    3. #else
    4.  chars[i].kernings[keys[j]] = charSpacing * chars[i].origKernings[keys[j]];
    5. #endif
    6.  
    I assume it's because Unity is no longer using a 5.x version number. Any suggestions on how to fix this? I can't find where the versions are defined. It would really suck if I have to replace the entire 2D interface, as well as many animations, just for this minor update.
     
  5. Brady

    Brady

    Joined:
    Sep 25, 2008
    Posts:
    2,474
    You can do a project-wide search-and-replace like so:

    Find: "|| UNITY_5_9)"
    Replace with: "|| UNITY_5_9 || UNITY_2017)"

    That should work if you apply that to all EZ GUI and SM2 scripts.
     
  6. John-B

    John-B

    Joined:
    Nov 14, 2009
    Posts:
    1,262
    Thanks. Unfortunately, that doesn't fix this particular problem. It just changes the null reference exception from line 2 to line 4 of that code snippet. I've been playing around with this a bit, but can't figure out what's undefined. I did have to add a float type cast to get that line to compile.

    chars.kernings[keys[j]] = charSpacing * (float)chars.origKernings[keys[j]];

    At least part of the problem seems to involve the font. The button text is not rendering. If I set the button text to another font, it shows in the Editor, though I still get the errors when I run. I also get those same errors in the Editor when changing sprite text settings in the Inspector when the program is not running.

    Also odd, when I run, all the text for the affected buttons is disabled, so even if I change the font, the button text is still hidden when I run. There's nothing in my code that enables or disables the button text. And it's only those 7 buttons with the bad font. The text on other buttons remains visible. Since I'm getting 7 errors, I'm assuming it's those 7 buttons.

    I'm starting to think that I'm not going to be able to make this work. Even if I can fix this one problem, I have no doubt that there will be more. There are also LOTS of warnings about functions soon to be deprecated, so who knows what the next Unity update will break. I'm afraid without a EZGUI update, I'm going to have to bite the bullet and re-do the entire 2D interface, along with lots of animations that also use EZGUI functions.
     
  7. Brady

    Brady

    Joined:
    Sep 25, 2008
    Posts:
    2,474
    Interesting. I'll take a look into this and see what I can figure out for you. If you have a repro case you could e-mail me privately, that might help expedite things as well. Thanks!
     
  8. Hungariano

    Hungariano

    Joined:
    Mar 24, 2009
    Posts:
    60
    Hi Brady,
    I am about to update my games that were made with Unity 4.x.
    I am using Unity 2017 and I have fixed some small issues but now I get an error I dont know how to solve. I have the latest versions of EZGui and SpriteManager installed.

    The error messages i get is:
    Assets/Editor/AnBSoft/Editors/UICtlEditor.cs(748,92): error CS0030: Cannot convert type `System.Enum' to `int'
    Assets/Editor/AnBSoft/Editors/UIPanelEditor.cs(356,92): error CS0030: Cannot convert type `System.Enum' to `int'

    And the code that causes the error is:
    Code (CSharp):
    1.     public System.Enum EnumField(string label, System.Enum selected)
    2.     {
    3. #if UNITY_IPHONE && !(UNITY_3_0 || UNITY_3_1 || UNITY_3_2 || UNITY_3_3 || UNITY_3_4 || UNITY_3_5 || UNITY_3_6 || UNITY_3_7 || UNITY_3_8 || UNITY_3_9 || UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_4_7 || UNITY_4_8 || UNITY_4_9 || UNITY_5_0 || UNITY_5_1 || UNITY_5_2 || UNITY_5_3 || UNITY_5_4 || UNITY_5_5 || UNITY_5_6 || UNITY_5_7 || UNITY_5_8 || UNITY_5_9)
    4.         GUILayout.Label(label);
    5.         return (System.Enum) System.Enum.ToObject(selected.GetType(), EditorGUILayout.Popup((int)selected, System.Enum.GetNames(selected.GetType()), GUILayout.Width(150f)));
    6. #else
    7.         return EditorGUILayout.EnumPopup(label, selected, GUILayout.Width(220f));
    8. #endif
    9.     }
    Hope you can help me.
    /Peter
     
  9. John-B

    John-B

    Joined:
    Nov 14, 2009
    Posts:
    1,262
    I've decided to go ahead and update the project to use Unity UI. Since this is a project I'm going to have to maintain for a while, I think this will save time in the long run.

    It's unfortunate that in addition to using EZGUI for the interface, I also used it quite extensively for animation. I've found a decent replacement, but replacing the animations is at least as big a job for me as switching over the UI. Any chance of a standalone animation package in the future?
     
  10. Brady

    Brady

    Joined:
    Sep 25, 2008
    Posts:
    2,474
    Hungariano, it looks like you just need to add "|| UNITY_2017" to each of those #if lines, so that the line ends up being:
    Code (csharp):
    1.  
    2. #if UNITY_IPHONE && !(UNITY_3_0 || UNITY_3_1 || UNITY_3_2 || UNITY_3_3 || UNITY_3_4 || UNITY_3_5 || UNITY_3_6 || UNITY_3_7 || UNITY_3_8 || UNITY_3_9 || UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_4_7 || UNITY_4_8 || UNITY_4_9 || UNITY_5_0 || UNITY_5_1 || UNITY_5_2 || UNITY_5_3 || UNITY_5_4 || UNITY_5_5 || UNITY_5_6 || UNITY_5_7 || UNITY_5_8 || UNITY_5_9 || UNITY_2017)
    3.  
    You will likely need to do a project-wide search and replace for "|| UNITY_5_9" and replace it with "|| UNITY_5_9 || UNITY_2017". That should bring everything up-to-date.


    John-B, not likely. Though it may not be too difficult to strip the animation part out by itself. If I get a chance, I'll look into the feasibility of that. And thanks so much for using EZ GUI for all these years. I'm glad it's been able to serve you up until recently.
     
  11. John-B

    John-B

    Joined:
    Nov 14, 2009
    Posts:
    1,262
    Thank you. EZGUI is one bit of software that I feel I've gotten more than my money's worth out of. I bought it in July 2010, soon after I started using Unity, and, until recently, have used it in every Unity project I've worked on. It was regularly maintained and always performed as advertised. It's unfortunate it had to be retired.
     
  12. Hungariano

    Hungariano

    Joined:
    Mar 24, 2009
    Posts:
    60
    Thanks Brady, I did what you suggested and it seems to work ok now
     
  13. zwluoqi

    zwluoqi

    Joined:
    Mar 20, 2013
    Posts:
    1
    Hello, I am working on a project that is currently a plug-in for EZGui.
    I have some questions to ask you. I found that EZGui worked well on Mac, but could not work properly on Android devices (unable to render text). After query, I found that my EZGui version did not support armv7 Android devices, and I found that there was only an x86 directory in the plugins directory, but no armv7 directory. I don't know if my plugin version is too old.
    My question is:
    1. Whether the latest EZGui can support armv7 2. Where can I get the latest version of EZGui
    3. Can EZGui support iOS64 bits

    and what‘s your e-mail
     
  14. Brady

    Brady

    Joined:
    Sep 25, 2008
    Posts:
    2,474
    Are you sure you're using EZ GUI? There isn't an x86 folder anywhere in the package, and there shouldn't be anything in EZ GUI that would prevent it from working on Android. In fact, there are many published Android projects which use it. As it only uses conventional textures, vertex data, and UVs, there shouldn't be anything keeping it from running on any platform Unity supports. Nothing exotic going on under the hood. I'll PM you with contact details.