Search Unity

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

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    "max size" property is pretty much a hack. When accessing texture information (which is what NGUI does), the original size of the texture is used. If you want it to be 256x256, then you should resize the texture in Photoshop to be 256x256.
     
  2. MikeBastien

    MikeBastien

    Joined:
    Apr 24, 2009
    Posts:
    139
    Hi ArenMook,

    Thanks for the reply!

    The problem is that it isn't just 'accessing' the information as you've indicated... it is actually changing the settings of the source textures, that I applied in Unity previously. It should not change any settings applied by a user.

    I already 'worked around it' though by resizing it in Photoshop as you suggested.

    However, it defeats one of the purposes of having 'Max Size'; in that I now to maintain multiple files of the same image at different resolutions.
     
  3. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    Assuming you care about quality, never rely on the built in resizing logic. I suggest keeping an Art folder outside Assets and keeping originals there.
     
  4. MikeBastien

    MikeBastien

    Joined:
    Apr 24, 2009
    Posts:
    139
    So are you suggesting that Unity's tool is useless?

    It seems so as you've now called it a 'hack', and are advising against using it. It's worked fine for me up until now...

    Will you be fixing NGUI to stop resetting texture settings?

    Thanks!

    :p
     
  5. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    Not useless, but limited. What NGUI does with textures it imports isn't a bug, so there is nothing to fix. As I mentioned, I suggest keeping your Art folder with the source files, and your game folder which is actually used by Unity separate. Generally this is the standard workflow anyway -- artists create huge PSD files in thousands by thousands dimensions for every small sprite just to make sure they get all the details correct -- and the Art repository is usually separate from Dev. It's a workflow issue.
     
  6. stevesz

    stevesz

    Joined:
    Sep 18, 2012
    Posts:
    5
    Hi Aren, when NGUI can support dynamic font feature integrated with Unity4?
     
  7. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
  8. Apiweb

    Apiweb

    Joined:
    Nov 26, 2011
    Posts:
    57
    Using the Inspector of Unity in TextLabel, I can add words accented (example: não, coração, etc ...) and also use multiple lines. But when I change this code for TextLabel, accents and multiple lines do not work.

    What might be happening?
     
  9. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    Your code file is likely not saved as UTF8, or the string is not passed as such, so it's limited to an ASCII charset. If you read the text value from a file (ie: use Localization), then it will work fine.
     
  10. bandingyue

    bandingyue

    Joined:
    Nov 25, 2011
    Posts:
    131
    hello.

    I have a question about ngui.

    as I know,ex2d can put font atlas and other sprite atlas into Only One Picture.

    can NGUI do this?

    it is useful to reduce drall call.

    thank you.
     
  11. RayTsang

    RayTsang

    Joined:
    Dec 14, 2012
    Posts:
    3
    Hi, I am trying to create a scrool panel runtime using code
    Here is the working code:

    int i;
    for (i=0;i<10;i++)
    {
    string text = "mission" + (i+1).ToString("D2");
    GameObject go = NGUITools.AddChild(dragPanel.gameObject,panelButton);

    go.name = text;
    UILabel uil = go.GetComponentInChildren<UILabel>();
    uil.text = text;
    }

    And now I want to remove all the child and create another new list.
    How can I remove all children from the panel?
     
  12. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    3,307
    When you use UTF-8 for encoding your code files, this is actually a problem with Unity: Unity or its Mono compiler has an issue with UTF8. I had filed a bug report on this for Unity 3 - and just checked and this behavior is still the same in Unity 4. What you can do if you want to have strings with special characters is using UTF-16 as encoding for your code files. However, that will make them look terrible in the code preview in the inspector.

    I had filed this as Case 377829 - Problem with code-file encodings (MonoDevelop / Unity) + console

    But it actually has nothing to do with MonoDevelop. Here's the bug description:

     
  13. mindlube

    mindlube

    Joined:
    Oct 3, 2008
    Posts:
    993
  14. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    3,307
    I have to correct myself: It does! Unity seemingly only supports little endian UTF-16. However, no matter which of the three UTF-16 encodings that MonoDevelop offers I choose, I seemingly get big endian UTF-16 (at least on the Mac).

    When you use Sublime Text or Visual Studio, you can select UTF-16 LE with BOM (Sublime Text) or Unicode - Codepage 1200 (Visual Studio) and it'll work.

    It's unfortunate that Unity doesn't do well with code files encoded as UTF-8 - but at least it's documented: Unity Reference: Font - Unicode Support

    There's a little trick, though: If you use UTF-8 with signature (BOM), all is well. So actually, using UTF-8 isn't the problem (as I thought for a little while now) but the missing signature is.

    So it really comes down to the problem that instead of simply creating files using UTF-8 with signature (which should be the standard for everything anywhere always, anyways), Unity seemingly uses "Western European (Windows) - Codepage 1252" ... which the Mono compiler seemingly also isn't doing too well with.

    Filed Case 510374 - Change default encoding when creating files to UTF-8 with Signature on this, so hopefully, some day Unity users will no longer have to worry about file encodings ;-)
     
  15. Wekthor

    Wekthor

    Joined:
    Apr 30, 2011
    Posts:
    164
    Hi, sorry if this was asked earlier, but i cant find anywhere proper answer to this nor solution. I wonder if its possible to create custom fonts. I mean textured fonts. There is bunch of tutorials on creating regular custom fonts, but i would need to support custom font created in photoshop, in the font are gradients,textures etc. so its not enough to just import font and give it some basic color. Is there way how to get this into ngui ? Thanks
     
  16. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    You can modify the texture before you create a font with NGUI. BMFont spits out a texture -- do what you want with it. I recommend making sure to export with some padding if you plan on adding things like drop down shadows.
     
  17. Wekthor

    Wekthor

    Joined:
    Apr 30, 2011
    Posts:
    164
    Awesome, got it working, thanks.
     
  18. bb2012

    bb2012

    Joined:
    Jan 2, 2013
    Posts:
    5
  19. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    If you buy NGUI, you will be able to upgrade by following instructions in the ReadMe file, and the watermark will be gone.
     
  20. unisip

    unisip

    Joined:
    Sep 15, 2010
    Posts:
    340
    Is anyone interested in Unity 4 dynamic font support in NGUI?
    The idea is to never have to use BMFont again, and directly use Unity fonts instead. The upside is that you can easily have different fonts and font sizes in NGUI without the hassle of managing all those BMFont created textures.

    If enough people are interested, I'm considering making this available as a simple package for NGUI, for 39$.
     
  21. NeoHoodman

    NeoHoodman

    Joined:
    Jan 8, 2013
    Posts:
    1
    Question: We've got quite an elaborate menu that consists of multiple widgets and scripts using setActive/setActiveRecursively (tried both).

    The problem we have is that whenever we update a Label or a Tabel, the entire background panel starts to flicker. Enabling and disabling the panel during gameplay removes the flickering for just a short bit, but it returns afterwards. AFAIK there are no widgets on the same depth or whatever. Any ideas?
     
  22. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    If you use different atlases or panels, then maybe Unity is simply not sure which one to draw first. Try adjusting the Z.
     
  23. cjow

    cjow

    Joined:
    Feb 29, 2012
    Posts:
    132
    Is it at all possible to make a scroll view where the contents of the grid can be swiped left and right ( or up and down ) and then dragged out into say an inventory slot or something.
     
  24. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    Possible? Sure. But you may have difficulty setting it up until you are familiar with NGUI. Drag drop example is actually set up like that -- you drag things out from one panel, and this panel can be draggable if set up as such.
     
  25. cjow

    cjow

    Joined:
    Feb 29, 2012
    Posts:
    132
    Cheers. The drag drop example didn't exist the last time I updated and nor did UIDragPanelContents or UIDraggablePanel.

    Here is an example of what it looks like so far however I still cannot separate the swiping of the panel from the dragging of the objects. Not sure if I've missed something though:



    Any suggestions?
     
    Last edited: Jan 14, 2013
  26. CazicThule

    CazicThule

    Joined:
    Nov 29, 2012
    Posts:
    95
    Is it possible to control NGUI programatically? For example, I want to make an inventory system. Obviously, the sprites shown would need to be dynamic based upon what the player has in their inventory. Is this possible?
     
  27. Extreme_u3Damon

    Extreme_u3Damon

    Joined:
    Aug 6, 2012
    Posts:
    66
    Hey i just bought this Pack about a year ago ! but really do not use it till now !
    now i get use to learn it and how its working
    i have a question

    Can NGUI support "R-T-L" texts ? i mean its using Atlases and it support Texture base FONT's so i can make my own "R-T-L" Base font like :"Persian , Arabic ,..."
    i just wonder is that capable of doing this or not ?!
     
  28. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    @cjow: You would have to manually disable the UIDraggablePanel script once you detect that the motion is dragging vertically rather than horizontally. Also please use the support forum to ask questions, not here.

    @CazicThule: Of course. All widgets are created programmatically under the hood when you use the Widget Tool.

    @Extreme: I didn't add any special RTL support to NGUI. You could just reverse all text and make it right-aligned though. It would achieve the same effect.
     
  29. Bowie-Xu

    Bowie-Xu

    Joined:
    Sep 14, 2011
    Posts:
    28
    Hi ArenMook
    I bought NGUI long time ago and try to register on NGUI forum and it is still "An Error Has Occurred!" -- "Your account is still awaiting admin approval."
    My register username is fantast_xu
    Can you help me with this please?

    Thanks a lot!
     
  30. hexdump

    hexdump

    Joined:
    Dec 29, 2008
    Posts:
    443
    Hi!,

    I'm really interested in buying NGUI. But would like to know something first:

    1) Does it play ok with 2dtoolkit? I just want to move my 2dtoolkit stuff into ngui. I use a 2dtoolkit camera and would like to keep it. I have read about some problems with world units between 2dtoolkit and ngui.

    2) Is there any visual editor to quickly design simple UI's?

    3) Is thee any example with a vertical list of items?

    Thanks in advance.
     
    Last edited: Jan 16, 2013
  31. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    @Bowie: Your account was blocked due to your IP address being listed on a spam-blocking website. I've gone ahead and approved it manually.

    @hexdump:
    1) Yes it plays fine with 2dtk as far as I know.
    2) The videos explain the workflow of NGUI pretty well.
    3) Assuming you mean a vertical scroll view: http://www.tasharen.com/ngui/dragdrop/
     
    Last edited: Jan 16, 2013
  32. hexdump

    hexdump

    Joined:
    Dec 29, 2008
    Posts:
    443
    HI again,

    I'm playing a bit with ngui after seeing and reading a bunch of tutorials and there's something I can't figure out. As I said before I want to use NGUI+2dtoolkit. I want to make NGUI show my 960x640 background pixel perfect at this resolution but rescale it to cover the screen in other. Another thing I need is show my 2dtoolkit sprites at correct sizes too.

    I have read in the forums that I have to set the height of the UIRoot manually and this is what I have done, it is set to 640 (min and max are set to 640 too). The problem is that the background is not covering all screen at 800x480 for example, 2 vertical bars are shown on the left and right of the camera. Don't know what to do next :/. Could you give a hand here please? It is a bit weird no "width" setting is available, isn't it?

    Thanks in advance.
     
    Last edited: Jan 16, 2013
  33. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    If you use one camera for 2d toolkit and another for NGUI, then it might be easier as the t wo don't conflict. You can use UIStretch to make a texture fill the screen.

    If you want to use just one camera, then you should remove the UIRoot altogether, and set your UI's scale to (1, 1, 1). Your UI can then be drawn by the same camera that's used by the 2d toolkit.
     
  34. Bowie-Xu

    Bowie-Xu

    Joined:
    Sep 14, 2011
    Posts:
    28
    Thank you very much ArenMook! Have a good day!
     
  35. cloyd

    cloyd

    Joined:
    Oct 17, 2012
    Posts:
    12
    i have ngui to angry bots project, and when i run the examples of ngui(example 3) it doesn't seem to work. buttons show up fine, but when a mouse hover happens, or the button clicked, the button show no response.

    Anyone have an idea why this is happening?
     
  36. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    No need to ask in two places, and for the record, the best place to ask is the support forum. Raycast Hit Triggers must be checked in physics settings.
     
  37. Deozaan

    Deozaan

    Joined:
    Oct 27, 2010
    Posts:
    707
    I've got a strange issue with NGUI wherein the GUI Camera creeps away when I move other children elements.

    Here's a video showing off the problem:

    http://screencast.com/t/6TbrUf7jB

    As you can see in the video, I'm using the latest version (v2.2.7c). Anyone else have this problem?

    EDIT: I just discovered that it doesn't' seem to matter what I move. It doesn't even have to be a child of the NGUI Camera. Any time I move anything in the scene, the NGUI Camera creeps away slowly. Here's another screencast:

    http://screencast.com/t/ZDi3i3bK


    SOLVED: User error. I accidentally added a UIAnchor script to the camera when trying to create a new Anchor GameObject. Removing that component kept it from repositioning itself all the time.
     
    Last edited: Jan 18, 2013
  38. cloyd

    cloyd

    Joined:
    Oct 17, 2012
    Posts:
    12
    Where can i find the physics properties?
    Is that on script or in unity?
    Sorry just noob...
     
  39. Karsten

    Karsten

    Joined:
    Apr 8, 2012
    Posts:
    187
    hi, sorry to kick in from nowhere, but eighter i am too stupid or it really dont works proper with the resolution independence...

    whatever placements i do if i switch aspect ratios its never at the same position, resolution maybe, but what is with relative position?
    so that if you place a widget somewhere, its center is always at the same place relative to the display size.Do you understand me?

    Edit: i think it has to do with the Orthograpic size of the camera, maybe put a function there that changes the ortho size in relevance to the screen aspect ratio???
    just my 2 cent
     
    Last edited: Jan 18, 2013
  40. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    @cloyd: Edit -> Project Settings -> Physics

    @Karsten: http://www.youtube.com/watch?v=XAeRXckXMMw might help you. Orthographic size must remain at 1. If you add a widget underneath an anchor set to center (default), then they will always stay relative to the middle of the screen. Switch it to "left" for example, and it will always be relative to the left side of the screen.
     
  41. hexdump

    hexdump

    Joined:
    Dec 29, 2008
    Posts:
    443
    Hi!,

    Well I finally decided to buy ngui, it seems a pretty neat UI solution. I have read a bunch of tutotorials and some vids, but need some help.

    Finally I decided to render 2dtoolkit stuff with a camera and ngui one with another (the one it creates under UI Root). The problem is when I try to position things on the screen.

    Here are some little questions I have:

    1) I set my resolution to 480x320. When I try to position a 2dtoolkit sprite with the mouse it is positioned as I expect. When I select a NGUI control and try to positionate it with the mouse it disappears from the scene (position values in the inspector get too big with little mouse movement).
    2) At the previous resolution (480x320) if I set the sprite position manually (editing transform component position in the inspector) to -240 it isn't positioned at the correct position. I expect it to be half part in the screen and half outside it (anchor is in the center), but it is positioned around 50-100 pixels from the left border.

    Sorry if this all are really basic questions, but after reading everything I couldn't make this out. Hope you could give a hand here.

    Thanks in advance.
     
    Last edited: Jan 21, 2013
  42. ArenMook

    ArenMook

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

    2d toolkit uses raw pixel sizes for transform coordinates, while NGUI uses 2 / Screen.height scaling so that the camera's Orthographic Size remains at 1. Everything underneath the UIRoot in NGUI is in pixels though (as the root is the only thing scaled).
     
  43. Hoskins355

    Hoskins355

    Joined:
    Jan 3, 2013
    Posts:
    142
    Just upgraded to the paid version now my project no longer works! It looks like verison 2.2.7c now resets all layers to 'Default', so collisions etc. doesn't work anymore. Must have to do something with recent changes to NGUI, since older versions still work fine (e.g. NGUI 2.1.4). So How can I import 2.1.4 into my project?
     
  44. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    NGUI doesn't reset layers for you, but it will unify them. Ie: if your panel is on the Default layer, but everything underneath the panel was on say, GUI layer, then NGUI will assign the panel's layer to everything underneath. Likewise, when changing the layer, you need to change it on the UIPanel rather than on individual widgets.
     
  45. Hoskins355

    Hoskins355

    Joined:
    Jan 3, 2013
    Posts:
    142
    Ok I am new to unity I have a project near completion I know it works fine on NGUI 2.1.4 but Not so Good on 2.2.7c can I get a copy of 2.1.4 I can provide what ever information you need to prove I have paid for NGUI.
     
  46. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    So you'd rather go back to an old version than learn what you're doing wrong and fix it? o_O

    Sorry, I don't keep old versions around, and 2.1.4 is very, very old.
     
  47. Hoskins355

    Hoskins355

    Joined:
    Jan 3, 2013
    Posts:
    142
    I was making a project based on The Tower Defense Started Kit which included the free distribution of NGUI. Everything worked great but I had the NGUI watermark. So I purchased NGUI to get ride of the watermark and now my project no longer works.
     
  48. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    Did you follow the upgrade instructions on the readme file? You need to completely delete NGUI folder before importing the updated package.
     
  49. Hoskins355

    Hoskins355

    Joined:
    Jan 3, 2013
    Posts:
    142
    Yes On the Tower Defense Forums they say they are aware of the issue and it has something to do with the new version. The distro free version included with tower defense worked fine but has the water mark.
     
  50. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    Unfortunately I can't do much about a third party package that may or may not have used NGUI correctly. For example, if TDTK created UI prefabs using Object.Instantiate instead of NGUITools.AddChild, then they won't be on correct layers. Incorrect layers will make NGUI force-fix this in order to work correctly (and spit out warnings in the console log). I suggest you talk to the author of TDTK and have them fix whatever they did incorrectly.

    In the meantime, you can simply select the UIRoot and change the layer back to what you need it to be.
     
Thread Status:
Not open for further replies.