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

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. Legacy

    Legacy

    Joined:
    Oct 11, 2011
    Posts:
    651
    I figured it was :) but other than that great product, it has been the best money i have spent, Excellent support and Excellent product.
     
  2. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
  3. hjupter

    hjupter

    Joined:
    Dec 23, 2011
    Posts:
    628
    Totally agreed :)
     
  4. hjupter

    hjupter

    Joined:
    Dec 23, 2011
    Posts:
    628
  5. mindlube

    mindlube

    Joined:
    Oct 3, 2008
    Posts:
    993
    Aren, there is minor error with iphone | android in v1.11
    Assets/NGUI/Scripts/UI/UIInput.cs(129,33): error CS0103: The name `mSelected' does not exist in the current context
    Just deleting that line seems to fix it.
    Also just another minor thing, on iOS when OpenGL 2.0 emulation is turned on in the editor, the Orc's shader looks bad. Just fyi- doesn't really affect me at all.
     

    Attached Files:

    • $orc.png
      $orc.png
      File size:
      130.2 KB
      Views:
      1,382
  6. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    The 'mSelected' was fixed yesterday with 1.11b, but I don't think it's on the asset store yet. Which version do you have? As for OpenGL 2.0 emulation -- as I recall OpenGL 2.0 supports shader language 1.1 at best, which is old -- very old. Catering to ancient hardware is a quick means to an end.
     
  7. mindlube

    mindlube

    Joined:
    Oct 3, 2008
    Posts:
    993
    Aren, OK- I'm at 1.11 from the asset store. Can you put the latest release notes up somewhere so I can check it and not bother you on the forum for stuff that's already fixed? ;)

    re: the orc shaders. OK but just so you know: by default Unity selects OpenGL ES 2.0 emulation when the project's platform is iOS or Android. So a lot of your customers are going to see the messed up shader.
     
  8. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    Ah, thanks for the tip. OpenGL 2.0 and OpenGL ES 2.0 are different things though. :) I am guessing the latter looks like that because of import options on the texture. Ensure that the textures are not compressed.

    If not that, then something isnt supported by the shader -- cube map texture perhaps. Going down to "good" quality settings should disable the cubemap reflection on the shoulderpads.
     
    Last edited: Dec 28, 2011
  9. ModernMosis

    ModernMosis

    Joined:
    Apr 28, 2011
    Posts:
    29
    Is there any support on how to make a slider bar. For say setting the Volume Level?
     
  10. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
  11. Legacy

    Legacy

    Joined:
    Oct 11, 2011
    Posts:
    651
    I have another request, how could i do an HP bar with this? Say the hp bar is placed over your npcs head and you damage him how would you resize it yet keep it anchored to the left? I have done this with unity GUI using:

    Code (csharp):
    1.  
    2. _curBarLength = (int)((curHealth / (float)maxHealth) * _maxBarLength);
    3. _display.pixelInset = new Rect(_display.pixelInset.x, _display.pixelInset.y, _curBarLength, _display.pixelInset.height);
    But this was not an hp bar i had position on the NPC it was an hp bar just positioned and drawn on the GUI Layer
     

    Attached Files:

  12. hjupter

    hjupter

    Joined:
    Dec 23, 2011
    Posts:
    628
    Its a simple 3d gameobject so you can do this
    Code (csharp):
    1. bar.localScale.x = (theMaxBarScale) * (curHealth/maxHealth);
     
  13. Legacy

    Legacy

    Joined:
    Oct 11, 2011
    Posts:
    651
    Wouldnt that just keep it centered tho? i need it to decrease from right to left :p
     
  14. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    What hjupter said :) -- and no it won't be centered if you uncheck the "centered" checkbox on the widget.
     
  15. Legacy

    Legacy

    Joined:
    Oct 11, 2011
    Posts:
    651
    Only problem is you cannot set the localscale.x you can only set variables to it
     
  16. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    Just look at what I did in the tutorial slider and follow suit. It's really simple.
     
  17. AlerZampi

    AlerZampi

    Joined:
    Dec 25, 2011
    Posts:
    27
    I have a problem with font. I have successfully made ​​the glyphs image using the Glyph Designer. But in the unit are not output gap (space). (The glyphs added)

    What i'm doing wrong?
     
  18. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    I'm not sure what you're asking...
     
  19. AlerZampi

    AlerZampi

    Joined:
    Dec 25, 2011
    Posts:
    27
    Sorry for my english :(

    Look at this for understand problem
     
  20. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    Oh you mean the spaces are missing... Is the space character getting exported? You need to make sure the entire UTF8/latin or Unicode character set gets exported or you will have missing characters like that.
     
  21. AlerZampi

    AlerZampi

    Joined:
    Dec 25, 2011
    Posts:
    27
  22. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    I'm not seeing a space in the list of characters there... although I admit I use BMFont here since I'm on a PC. Can you manually add a space to the included glyphs box on the bottom right? The problem is that the text definition for the font is missing an entry for the space character, not the texture.

    Mojno po russki, ya poimu.
     
  23. EskemaGames

    EskemaGames

    Joined:
    Jun 23, 2010
    Posts:
    319
    I've noticed that issue too (fonts without gap), and in my case I've fixed that just increasing the size of the font. So for example a font called XXX with 20 pixels size won't display spaces but increasing the size to 24 it does.
    This seems to be a totally random issue because depends on the font, some fonts works ok and some others doesn't. And yes, in all cases the empty space char definition was added to the fnt file
     
  24. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    Interesting. Can you send me the exported text definition and the texture that goes with it that was affected by this issue? I'd like to have a look at it on my end.
     
  25. EskemaGames

    EskemaGames

    Joined:
    Jun 23, 2010
    Posts:
    319
    I will as soon as I remember the font LOL!!!
     
  26. Quickfingers

    Quickfingers

    Joined:
    Aug 29, 2009
    Posts:
    268
    hey ArenMook, latest version from your site, UILabel.lineWidth always returns 0 no matter what the label.text is. Any thoughts on why this might be?

    Many thanks!
     
  27. AlerZampi

    AlerZampi

    Joined:
    Dec 25, 2011
    Posts:
    27
    Aren, you can see char of space between "*" and "й" chars.
     
  28. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    @quickfingers: That's the maximum width of the label in pixels. If you set it to 300, then the printed text won't exceed 300 pixels in length, and will get word-wrapped (if multi-line) or cut off (if single line). If you're trying to get the size of the printed text, look at UIFont.CalculatePrintedSize.

    @AlerZampi: Can you send me the affected font definition and its texture?
     
  29. AlerZampi

    AlerZampi

    Joined:
    Dec 25, 2011
    Posts:
    27
    grab it: http://www.sendspace.com/file/86xmqz. Thanks for support Aren.

    ps Я очень рад, что купил пакэйдж у русскоговорящего разработчика
     
  30. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
  31. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    Done. Your font now gets imported correctly. Grab version 1.12 from the download link you got via PayPal, or I can PM you the updated file if you grabbed it from the Asset Store.
     
  32. AlerZampi

    AlerZampi

    Joined:
    Dec 25, 2011
    Posts:
    27
    Aren, thank a lot! Work fine
     
  33. ModernMosis

    ModernMosis

    Joined:
    Apr 28, 2011
    Posts:
    29
    Hey so i wrote a little script to change the Label's Text. It Changes the Text on the Label in the Inspector but not in the game or scene view. Is there a method i need to call to update the scene/game.
     
  34. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    Nothing else is needed, but the actual mesh gets re-created in the next frame, so if the game is paused you won't see anything changing.
     
  35. SoulWind

    SoulWind

    Joined:
    Aug 25, 2011
    Posts:
    23
    Hi ArenMook,
    How can I change a sprite by code while game is running?
     
  36. Quickfingers

    Quickfingers

    Joined:
    Aug 29, 2009
    Posts:
    268
    cool thanks for the info on calculating the text size. That was what I needed and worked great :) Also inner rects are storing correctly now, (can't remember if I told u before, but nice that everything is working great now, hopefully you'll see lots of NGUI in my flash compo game releasing soon ;)
     
  37. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    @SoulWind: Just assign it by name: UISprite.spriteName.

    @quickfingers: I am looking forward to seeing what you come up with!
     
  38. ModernMosis

    ModernMosis

    Joined:
    Apr 28, 2011
    Posts:
    29
    The Game isnt paused its Playing and there is no change.
     
  39. SoulWind

    SoulWind

    Joined:
    Aug 25, 2011
    Posts:
    23
    Emmmm,
    I changed spriteName
    but the sprite didn't change in scene...
     
  40. SteveJ

    SteveJ

    Joined:
    Mar 26, 2010
    Posts:
    3,085
    Do the UISprite and UISlicedSprite behave the same in terms of events?

    I have no problem getting scripts to run on buttons created from UISprites (using a collider and OnPress event), but when I try to do the same thing on a UISlicedSprite, the event never fires.

    Not sure what I'm doing wrong.
     
  41. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    They behave exactly the same, the only difference is visual. Check the dimensions of your collider, and ensure that the script receiving the event is on the same game object as that collider.
     
  42. SteveJ

    SteveJ

    Joined:
    Mar 26, 2010
    Posts:
    3,085
    Yep - that's definitely all correct. I've even tried just adding your UIPlaySoundOnClick script to it for testing and that doesn't work either. It's quite bizarre.

    Will keep tinkering.
     
  43. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    If you get stumped you can create a package for me and I'll take a look.

    @SoulWind: Let me double check that it's all still working fine. It's case-sensitive, and the sprite must be in the atlas.
     
    Last edited: Dec 30, 2011
  44. SteveJ

    SteveJ

    Joined:
    Mar 26, 2010
    Posts:
    3,085
    :)

    Hadn't changed the layer on these new items to the UI layer.................

    PS: Yes, that is the grin of a dumbass...
     
  45. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    That would do it. :p
     
  46. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    @SoulWind: Double-checked it, works fine. Here is a simple script I wrote:

    Code (csharp):
    1.  
    2. [AddComponentMenu("NGUI/UI/Image Button")]
    3. public class UIImageButton : MonoBehaviour
    4. {
    5.     public UISprite target;
    6.     public string normalSprite;
    7.     public string hoverSprite;
    8.     public string pressedSprite;
    9.  
    10.     void Start ()
    11.     {
    12.         if (target == null) target = GetComponentInChildren<UISprite>();
    13.     }
    14.  
    15.     void OnHover (bool isOver)
    16.     {
    17.         if (target != null) target.spriteName = isOver ? hoverSprite : normalSprite;
    18.     }
    19.  
    20.     void OnPress (bool pressed)
    21.     {
    22.         if (target != null) target.spriteName = pressed ? pressedSprite : normalSprite;
    23.     }
    24. }
    I used the SciFi atlas, and put "Button", "Light" and "Dark" for normal, hover, and pressed sprites, respectively.
     
  47. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    I had a look at this as well, and it's all working just fine as far as I can tell.

    Code (csharp):
    1. public class Test : MonoBehaviour
    2. {
    3.     UILabel lbl;
    4.  
    5.     void Start ()
    6.     {
    7.         lbl = GetComponentInChildren<UILabel>();
    8.     }
    9.  
    10.     void OnHover (bool isOver)
    11.     {
    12.         if (lbl != null) lbl.text = isOver ? "Over" : "Normal";
    13.     }
    14.  
    15.     void OnPress (bool pressed)
    16.     {
    17.         if (lbl != null) lbl.text = pressed ? "Pressed" : "Normal";
    18.     }
    19. }
    Here's tutorial 8 with both scripts attached and color state script removed btw: http://www.tasharen.com/ngui/WebPlayer.html
     
    Last edited: Dec 30, 2011
  48. SoulWind

    SoulWind

    Joined:
    Aug 25, 2011
    Posts:
    23
    OMG........I forget the .png.....
    Sorry to waste your time..
     
  49. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    No worries. :)
     
  50. SoulWind

    SoulWind

    Joined:
    Aug 25, 2011
    Posts:
    23
    I try to change a sprite color by unity animation
    when play I found the color in Inspector changed,but the sprite in scene view didn't....
     
Thread Status:
Not open for further replies.