Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

NGUI (Next-Gen UI) -- demo final feedback request

Discussion in 'Assets and Asset Store' started by ArenMook, Dec 8, 2011.

Thread Status:
Not open for further replies.
  1. guppyd

    guppyd

    Joined:
    Jan 28, 2013
    Posts:
    2
    Hi!

    I find if I create buttons in run-time, i get the warning "button has nothing for UIButtonColor to color".

    When the mouse leaves the button area, the background sliced sprite turns invisible(Color Tint is black).

    I guess that is caused by mColor of ButtonColor doesn't have default value;

    Below is my code.

    Or I use the wrong way to create buttons!!

    Thank you.
     
  2. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    Why are you doing this? Create your button, save it as a prefab, instantiate it via NGUITools.AddChild, modify whatever values you need. There is pretty much never any need to create anything programmatically.
     
  3. ProjectOne

    ProjectOne

    Joined:
    Aug 9, 2010
    Posts:
    442
    ArenMook,
    just started using NGUI, nice too.

    I was looking into Universal Binary iOS (iPhone Unretina + iPhone Retina + iPad Unretina + iPad Retina) graphics with NGUI and I saw your video tutorial on SD/HD Atlas and Reference Atlas

    My understanding is that for Universal Binary you do need 4 sets of graphics 2 for iPhone SD/HD and 2 for iPad SD/HD although you could have the iPhone Retina to be the same as the iPad Unretina.

    Anyway....

    1) With NGUI will it be simply a matter of creating 3 or 4 dedicated Atlases (1 per resolution) and just using a Reference Atlas to build the scene? (in this case a 2D side scroller)

    2) Does the NGUI documentation/samples have a sample script to do what you mention in the video? Create a script to automatically switch Referenced Atlas based on screen resolution?

    3) I was looking at the UIRoot Class Reference, I wanted to understand the use and relation between

    Reference Atlas

    and

    UIRoot
    - Scaling Style (FixedSize/PixelPerfect/FixedSizeOnMobile)

    The video is from an older version of NGUI and only mentions Automatic (not longer used)

    so... In the case where I want a Universal Binary for iPad/iPhone both SD and HD and with a game in Landscape orientation... what Should I choose for
    - Scaling Style
    - Manual Height
    - Minium Height
    - Maximum Height
    ... when using Reference Atlas and multiple Atlases for all the resolutions

    Long set of questions but hopefully answers are simple :)

    Thanks
     
  4. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
  5. ProjectOne

    ProjectOne

    Joined:
    Aug 9, 2010
    Posts:
    442
    Thanks, will do
     
  6. TechnicalArtist

    TechnicalArtist

    Joined:
    Jul 9, 2012
    Posts:
    736
    Hi,

    I have only use single camera for reason stereoscopic,when i add image effects like blur or any other effect,its also effect on Ngui also,can possible remove image effects on Ngui?

    In advance thank you.

    Dev
     
  7. Oksana-Iashchuk

    Oksana-Iashchuk

    Joined:
    Sep 10, 2012
    Posts:
    126
    Hello All,

    I'm working on http://u3d.as/content/orange-tree/sqlite-kit/3ka , I think it's good for localization solution I mean text in Google Speadsheet -> database -> GUI Label, images....
    Lets talk what is the best idea how to integrate with NGUI?
     
  8. tempbuffer

    tempbuffer

    Joined:
    Dec 6, 2012
    Posts:
    14
    Hi, i want to let a UIPanel to move in&out with itween, so during moving I want it be disabled but not invisible.
    In a word, i want to disable a whole panel but not let it disappear by setActive. I know there is a isEnable in UIButton, but I didn't find the same property in other widgets.
    For example, i want to create a slider to show hp, but do not need player to drag it, how can I do it?
     
  9. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    Please use the NGUI support forum to ask questions: http://www.tasharen.com/forum/index.php?board=1.0

    You will want to disable colliders if you don't want the widgets to not be interactable. A panel by itself is nothing but a container that draws stuff and has nothing to do with visibility or interaction.
     
  10. jugnu

    jugnu

    Joined:
    Jul 17, 2012
    Posts:
    28
    Hi, I need to make a level selection sliding panel on Next Previous button clicks, i am using NGUI, how can i make it easily, as i am doing this for first time, any help will be appreciated. Or better if there is any tutorial or youtube video.
     
  11. atmuc

    atmuc

    Joined:
    Feb 28, 2011
    Posts:
    1,147
    is there any problem with ngui? nowadays nearly everyday i get a ngui update :)
     
  12. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    Normally I fix minor bugs locally and push them in the next update, but I wanted 2.3.3 to be as stable as possible, so I kept pushing fixes as soon as the issues were spotted. It was a long weekend here in Canada, figured I'd take advantage of it!
     
  13. gameboy

    gameboy

    Joined:
    Mar 25, 2009
    Posts:
    37
    I've been trying to implement a vertical scrolling list of buttons within a soft-clipped panel, but I can't quite seem to get anything to work right, despite viewing the Example 7 Scroll View Clipped Panel writeup.

    Aren, I was wondering if you would make a video tutorial going through the steps of creating such a list. :mrgreen: (please)

    Ultimately, I would like to create a UI where the contents of the scrolled list changes according to other buttons outside the clipped panel, and where pressing each item in the scrolled list toggles them through three possible states (and have their appearance change according to their current state). But that is the end goal. Right now I'm just looking to get started with a simple vertical scrolling list, similar to the horizontal one you created in example 7.
     
  14. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    Please use the support forum for support-related questions.

    This video tutorial shows how to turn the horizontal drag drop example which uses a scrollable clipped panel into a vertical one: http://www.tasharen.com/ngui/dragdrop/
     
  15. Zyxil

    Zyxil

    Joined:
    Nov 23, 2009
    Posts:
    111
    Gameboy, check my posts on the NGUI forums. I did a solution for this with lots of discussion on the board.
     
  16. gameboy

    gameboy

    Joined:
    Mar 25, 2009
    Posts:
    37
    Zyxil,

    I see on your NGUI post you are using a perspective camera, trying to create a "3D" UI. I am just trying to produce a 2D UI.

    I'm still unclear about all this. :confused:
     
  17. Zyxil

    Zyxil

    Joined:
    Nov 23, 2009
    Posts:
    111
    Sorry, didn't mean to add noise to the conversation. The provided examples can be tough to follow but they do give a good overview of how to implement.
     
  18. Dover8

    Dover8

    Joined:
    Aug 20, 2010
    Posts:
    94
    Can work in any 3.5.x by changing all the:

    Code (csharp):
    1. #if UNITY_3_5_4
    to:

    Code (csharp):
    1. #if UNITY_3_5
     
  19. dev01

    dev01

    Joined:
    May 3, 2010
    Posts:
    21
    Is there a way to make a countdown timer and when it reaches 0 load or reveal another button like " play again"
    I can't seem to find an answer. I would like to use ngui for this
     
  20. dkozar

    dkozar

    Joined:
    Nov 30, 2009
    Posts:
    1,410
    Unity doesn't have a native timer. You could use this lib (Timer class). Usage:

    Code (csharp):
    1. int _count = 5;
    2. void Start() {
    3.     Timer t = new Timer(1, 5); // tick each second, five times
    4.     t.Tick += delegate { _count--; Debug.Log("Timer tick: " + _count); };
    5.     t.Complete += delegate { Debug.Log("Timer complete. Now showing the 'Play again' button..."); };
    6.     t.Start();
    7. }
     
  21. dev01

    dev01

    Joined:
    May 3, 2010
    Posts:
    21
    how do I put it in Unity?
     
  22. dkozar

    dkozar

    Joined:
    Nov 30, 2009
    Posts:
    1,410
    Just: 1. put the "Core" DLL from the package above into your Unity project. 2. Add "using eDriven.Core.Util" on top of your class file.

    ps. Sorry to readers! Didn't meant to hijack a thread, but the question was more about timers than about GUI.
    dev01, please ask any further questions in this thread. :)
     
  23. dev01

    dev01

    Joined:
    May 3, 2010
    Posts:
    21
    Im getting an error...


    using UnityEngine;
    using System.Collections;
    using eDriven.Core.Util;
    public class Timer : MonoBehaviour
    {

    int _count = 10;

    void Start() {

    Timer t = new Timer(1,10); // tick each second, five times

    t.Tick += delegate { _count--; Debug.Log("Timer tick: " + _count); };

    t.Complete += delegate { Debug.Log("Timer complete. Now showing the 'Play again' button..."); };

    t.Start();

    // error
    Assets/Timer.cs(11,30): error CS1729: The type `Timer' does not contain a constructor that takes `2' arguments

    }
    }
     
  24. dkozar

    dkozar

    Joined:
    Nov 30, 2009
    Posts:
    1,410
    You must choose a different name for your script. The complete script:

    Code (csharp):
    1. using eDriven.Core.Util;
    2. using UnityEngine;
    3.  
    4. public class TimerScript : MonoBehaviour {
    5.     int _count = 5;
    6.     void Start()
    7.     {
    8.         Timer t = new Timer(1, 5); // tick each second, five times
    9.         t.Tick += delegate { _count--; Debug.Log("Timer tick: " + _count); };
    10.         t.Complete += delegate { Debug.Log("Timer complete. Now showing the 'Play again' button..."); };
    11.         t.Start();
    12.     }
    13. }
    Note that the timer works with NGUI and well as with all the other Unity packages. It just enables the asynchronous notation (but delegates are being run within a same thread, like they are being inside the Update method of MonoBehaviour).
     
  25. macdude2

    macdude2

    Joined:
    Sep 22, 2010
    Posts:
    686
    I am sure this has already been answered, but... Is the only way to get a new font to work with NGUI on the mac to spend $10 on bmGlyph and then export a font from that application? Is there really no way to get the font and the txt out of font book or some other free application? Or a website that has the txt necessary included with the font? Thanks.
     
  26. macdude2

    macdude2

    Joined:
    Sep 22, 2010
    Posts:
    686
    Accidental double Post...
     
  27. petrucio

    petrucio

    Joined:
    Aug 30, 2011
    Posts:
    126
    The Mac application culture has less freewares to go around than Windows. If you really want to use a Mac for development, you should be confortable with that basic fact of Mac life. And no, it's not the only way - you COULD install a windows box and run BMFont from there... :D

    Not possible, since the contents of the txt will change according to different export settings (font size, outline, padding, etc)
     
  28. macdude2

    macdude2

    Joined:
    Sep 22, 2010
    Posts:
    686
    Hmmm, didn't realize it was going to be that way... Is there any way to at least display NGUI's standard included fonts at a higher resolution so they look crisp on the retina devices without buying the $10 app?
     
  29. petrucio

    petrucio

    Joined:
    Aug 30, 2011
    Posts:
    126
    I think those don't even come with the font used to make them in the first place, so that's even harder. Maybe if you ask Arenmook the name of the font you want, he might send you some larger sizes.

    I have an Arial Black here exported in 32, 64, and 128 that you can use if it suits you:
    View attachment $ArialBlack.zip
     
  30. mindlube

    mindlube

    Joined:
    Oct 3, 2008
    Posts:
    993
    For the Mac you can use this free java app Hiero:

    http://slick.cokeandcode.com/demos/hiero.jnlp (your mileage may vary though)

    Glyph Designer (paid) -- I use this one

    bmGlyph (paid)

    Yes you definitely need a bitmap font creator if you are going to do game development with Unity+NGUI (or most other game engines for that matter)
     
  31. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,610
    Does NGUI play nicely with Unity Remote?

    I'm not entirely sure, but it seems like events are being handled oddly from Remote. Pressing GUI buttons triggers them twice at once, and it generally seems like touches also fire mouse events. I tried disabling the use of the mouse in UICamera as suggested in an old post, but then OnClick doesn't seem to get fired (even though the button gets darker when I tap it, though this seems to be a mouse thing as it stays darker unless I drag off it), though OnPress does seem to work.

    I've got some semi-complex multi-touch behaviour to implement, so solving this may literally save me hours of re-deploy time over the coming days.
     
  32. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    Remote doesn't play nicely with anything. :p

    It sends events twice from the same action -- one for the mouse event, and again for touch from the mouse event. Uncheck "mouse events" on the UICamera.
     
  33. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,610
    Ah, silly me, I didn't think to look at the exposed properties. That makes life too easy!

    Thanks for the super fast response, too.
     
  34. macdude2

    macdude2

    Joined:
    Sep 22, 2010
    Posts:
    686
    @ petrucio - thanks for the arial – I will use that for now.
    @ mindlube - I could not get Hiero to work? I try and open it up and then it immediately crashes... Is that what you meant by "Your milage may vary"? ;) Thanks for the suggestion though.
     
  35. Tsurugi

    Tsurugi

    Joined:
    Sep 21, 2012
    Posts:
    97
    just wonder if i can use ngui scripts on fastgui.....
    if i can use it do i still need to use the prefix in photoshop?
     
  36. friuns3

    friuns3

    Joined:
    Oct 30, 2009
    Posts:
    307
    after unity refreshes scripts in play mode, buttons stop working, too bad(
     
  37. Tsurugi

    Tsurugi

    Joined:
    Sep 21, 2012
    Posts:
    97
    @friuns3 r u responding to my question?
     
  38. Toa

    Toa

    Joined:
    Dec 11, 2012
    Posts:
    3
    Hey,

    we are currently using the free version of NGUI but we are intended to buy the newest version. I just wanted to ask the developer how extensive a port to the newest version would be. Can we still use our scenes with NGUI Objects and change the backend? Or is it more complex? We need to change the version within 2 Days. Gretz T0a
     
  39. BrendanKZN

    BrendanKZN

    Joined:
    Jun 22, 2011
    Posts:
    157
    You might want to ask your question here http://www.tasharen.com/forum to get a quicker response if you need it within 2 days.
     
  40. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    Upgrade from free to full should be just a matter of replacing the NGUI folder.
     
  41. Dot45

    Dot45

    Joined:
    Jan 27, 2010
    Posts:
    33
    $69878_401494666613506_268216412_n.jpg

    I have a problem with UIAnchor, If you see the pivot that modify by UIAnchor , it's bottom-right which is correct , but the sprites are wrong position(the colliders are in the correct position) , how to
    fix it?

    ps.the UI is categorized as bottom right group , top right group and they can be deactivate or activate at run-time .
     
  42. dustinandrew

    dustinandrew

    Joined:
    Apr 30, 2010
    Posts:
    102
    I'm trying to setup a split screen with 2 cameras and 2 NGUI roots. I'm changing the camera's viewport rect and can't seem to get the second NGUI camera to line up.

    Camera 1 - Layer: Cam1, Cam Rect: 0, 0, 0.5, 1 - Displays correct
    NGUI 1 - Layer: NGUI1, Cam Rect: 0, 0, 0.5, 1 - Displays correct


    Camera 2 - Layer: Cam2, Cam Rect: 0.5, 0, 0.5, 1 - Displays correct
    NGUI 2 - Layer: NGUI2, Cam Rect: 0.5, 0, 0.5, 1 - Does not show up and appears to be in the same position as NGUI 1.

    Any ideas?
    Thanks!

    EDIT: FIXED! A duplicated NGUI root still has references to the first root's camera. duh!
     
    Last edited: Mar 20, 2013
  43. eskimojoe

    eskimojoe

    Joined:
    Jun 4, 2012
    Posts:
    1,440
    @ArenMook,

    I removed my posts about NGUI vs. eDriven comparisons on other threads. It was uncalled for and I am sorry for such behaviour.


    People are advised to take a second look at NGUI and that other GUI solutions have both advantages and disadvantages. One solution is no lesser than other; Each have their own ways of doing things and it is reminded to select the best choice / best solution appropriate to their needs.


     
  44. tomhog

    tomhog

    Joined:
    Dec 22, 2012
    Posts:
    36
    Hi

    Just purchased Fast GUI, seems like it will do what I need, but I keep running into bugs.

    I'm using unity 4.1, PhotoShop CS6

    First bug is with photoshop, you get a crash in the plugin if the text uses pure black.

    Then when doing the conversion in Unity i keep getting crashes related to Textures being released/destroyed

    One was in
    static void ExtractSprites (UIAtlas atlas, List<SpriteEntry> sprites)

    Changed to look like this

    foreach (SpriteEntry se in sprites)
    {
    if(se.tex != null){
    if (asp.name == se.tex.name)

    That fixed that, then did a new test today and I'm now getting error in

    static UIAtlas.Sprite AddSprite (List<UIAtlas.Sprite> sprites, SpriteEntry se)

    First fix was similar thing

    foreach (UIAtlas.Sprite sp in sprites)
    {
    if(se.tex != null) {
    if (sp.name == se.tex.name)

    but then get a crash at

    else
    {
    sprite = new UIAtlas.Sprite();
    sprite.name = se.tex.name;

    around line 287 ish

    Not sure what to do with this one as not sure what name to use if the texture is gone.

    If I could get some help it would be appreciated, otherwise I'm gonna need a refund as this is broken, and I can't spend
    too long fixing it.

    Thanks
    Tom
     
  45. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    FastGUI is a third-party add-on for NGUI. You should contact its author instead.
     
  46. tomhog

    tomhog

    Joined:
    Dec 22, 2012
    Posts:
    36
    Sorry about that, followed the lwrong link from the FastGUI page on the asset store.
     
  47. EmeralLotus

    EmeralLotus

    Joined:
    Aug 10, 2012
    Posts:
    1,459
    Hi ArenMook,
    We are publish to Flash and are running into quite a few problems.

    A while ago you wrote

    " Well, I had a look at what's wrong. It seems what Unity does is "translates" C# into ActionScript, and not everything is supported. I can't use HashSet, MemoryStream or StreamReader. TryParse methods are also not supported (ie. int.TryParse). Fun times... So essentially to fix this I will need to write my own hash implementation, use try/catch instead of TryParse, and... I'm not even sure what to do about lack of IO functions. If I can't read the data from a file, that's a bit of a problem. I suppose one way of going around it would be to have font information get imported only once in the editor (the way sprites get imported from TexturePacker).

    I'll have to give it some thought, but at this rate it will take a couple of days to resolve these issues.

    Edit: Eww, Enum.GetNames isn't supported either!

    Edit #2: Done. Vesion 1.10 supports Flash.
    "

    Since you are pioneer in Unity Flash, can you offer advice on how you solved some the problems above.

    1. TryParse()
    2. Hashet
    3. IO
    4. any other advice you might have.

    Thanks.
     
  48. dsjunnesson

    dsjunnesson

    Joined:
    Dec 3, 2012
    Posts:
    15
    Hey,

    Im building a Android application that uses a input field. It works good to click on the field which brings up the keyboard and you can type in easily. The problem Im having is when Im leaving the input field I need to click on the screen first once to hide the keyboard and then another to click on a button. So basically there is one extra click that I have to unfocus the input field.

    Is there any way to avoid this extra step? Is there something that I can do with this variable?

    bool UICamera.inputHasFocus = false
     
  49. DBarlok

    DBarlok

    Joined:
    Apr 24, 2013
    Posts:
    268
    NGUI is so powerfull. Leearning curve was hard for a guy with native tongue in Spanish (Argentinian), but the secret are the examples scenes, for anybody out there trying to figure out things.

    UIRoot, UIAnchor, UIStrectch --> Resolution Independance. :cool:

    UIRoot goes on Manual, for example, clamped at 1024x768.

    Always use GameObjects with the concept of Widgets. (put all inside a GameObject and think about a Widget).

    Use relative size of UIStretch , and GameObject scale to position your "Widget".

    Enjoy resolution independent.

    I was having a hard time with NGUI because of languaje barrier, but now it flows like a charm.

    Congrats to Tascharen for this amazing and life saver package.
     
    Last edited: Apr 24, 2013
  50. otto

    otto

    Joined:
    May 8, 2013
    Posts:
    2
    Hi,

    We’re working on a game for IOS and we’re using NGUI for creating UI elements. NGUI seems to be really efficient tool for UI creation, but we have had some troubles with swiping.

    We’re planning to do level selection where a player could browse different levels by swiping them pretty much similar like album covers in iTunes. We have currently implemented swiping by following the structure of NGUI’s Example 8 - Scroll View (Camera), but it’s not as responsive and smooth as we hoped. Would you recommend using some other plugin like Easy Touch 3 or Fingergestures, or any other advices?

    We could implement the swiping functionality from scratch, but it would be nice to save some time if there are some good solutions or any advice to share. Thanks!
     
Thread Status:
Not open for further replies.