Author Topic: (!!!) Improving NGUI: Voice your opinion  (Read 166541 times)

Wahooney

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 31
    • View Profile
Re: (!!!) Improving NGUI: Voice your opinion
« Reply #195 on: January 28, 2014, 04:25:40 AM »
You can already have bold, italic, underline, strike-through as well as sup/subscript. Check the UILabel documentation.

Ah, I thought those were per label. I'd still like the rest though ;)

Asmolicious

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 1
    • View Profile
Re: (!!!) Improving NGUI: Voice your opinion
« Reply #196 on: January 29, 2014, 12:35:41 AM »
I'm a professional UI games developer and I'm using NGUI for a personal project. Great work!

I've been getting to grips with NGUI.

Being able to extend existing classes would be great.

For your button delegates, adding support for basic types (bool, int, float & string) as a parameter would be great. I find I have to have a function for each button which often just sets an int / enum and is funneled to a main button press function.

Motion is a very important part of UIs for me, having the ability to define a group of tweens such as transition in / out and being able to call them would be a great core feature.

Thanks!

Wahooney

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 31
    • View Profile
Re: (!!!) Improving NGUI: Voice your opinion
« Reply #197 on: January 29, 2014, 10:19:05 AM »
Request from one of my colleagues I thought I'd throw out there. Rotation of the sprite in it's local coordinates, the way that sprite sizes are now internalized.

This means that the sprite's transform orthogonal directions are unchanged by the visual rotation, this can be achieved with parenting, but it does muck up your hierarchy a bit.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: (!!!) Improving NGUI: Voice your opinion
« Reply #198 on: January 29, 2014, 10:22:57 AM »
@Asmolicious: UIButton.current tells you what called the On Click function. No need to have many functions. Same with toggle (UIToggle.current), input (UIInput.current), camera (UICamera.current), etc. All NGUI classes are set up the same way. The 'current' value is set right before a callback.

ryan

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 90
    • View Profile
Re: (!!!) Improving NGUI: Voice your opinion
« Reply #199 on: January 29, 2014, 04:26:35 PM »
Motion is a very important part of UIs for me, having the ability to define a group of tweens such as transition in / out and being able to call them would be a great core feature.

+1 to that.  I have a hard time deciding whether or not to have UI artists put tweens into the UI prefabs, for fear that an engineer will tween something from code, overwriting what the artists put in.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: (!!!) Improving NGUI: Voice your opinion
« Reply #200 on: January 29, 2014, 11:10:06 PM »
You can also use the Unity's animation system if tweens are not complex enough for your liking. CTRL+6 and start recording.

2cat

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 10
    • View Profile
Re: (!!!) Improving NGUI: Voice your opinion
« Reply #201 on: January 30, 2014, 08:27:34 AM »
I just started exploring NGUI 3x for our new project and although there's many a great addition I do think some stuff could be improved/added.

-The handles for widgets can only turn on or off. I personally really like the scale and even rotate handles, but I really hate how I can't use the move gizmo to only move over the x or y axis. Dragging via the transform box is just a pain in the butt as well. Would love an option to disable certain handles instead of only being able to turn all on or off.
-Tween Height and Width, but no "combined" script. It feels like a waste to have to reference to two scrips each time I wish to scale, instead of one.
-Attaching a button script on a widget doesn't automatically add a collider and there's no option for an imagebutton(you can still of course find it in the scripts folder but still..)
-The legacy widget tool says you can search for "Control" and add it to your scene but there's nothing that contains the name "Control" in my project folder when using the latest NGUI from the asset store. I can't say it works like it, but I like the widget tool because you float the window anywhere and create stuff on the fly without having to browse trough menus. Would love to know where I can find control and find out what it does.
-No more hotkeys for atlas maker ;_;

All the changes take a bit getting used to but mostly it's all positive. I hope all the above is something you can agree with and ends up on your todo list, it would greatly benefit myself and I hope it will others as well.


ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: (!!!) Improving NGUI: Voice your opinion
« Reply #202 on: January 30, 2014, 12:18:53 PM »
If you can't see anything named "Control", then you didn't import the Examples folder.

jingato

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 15
    • View Profile
Re: (!!!) Improving NGUI: Voice your opinion
« Reply #203 on: January 30, 2014, 01:53:32 PM »
@Asmolicious: UIButton.current tells you what called the On Click function. No need to have many functions. Same with toggle (UIToggle.current), input (UIInput.current), camera (UICamera.current), etc. All NGUI classes are set up the same way. The 'current' value is set right before a callback.

That is helpful, but most of the time having a reference to the button doesn't give much. If you are creating a scroll  list of buttons for example you would want to know which index you pressed which means you either need another script on the button which tracks the buttons index or you have to use the name of the gameobject to keep track of it, which I don't like. It would be nice if the buttons on click event could pass in parameters like and int, string, or enum. That would also be helpful when creating static UI so you can have one function for a set of buttons and pass in a parameter set in the inspector.

this is a pretty important feature that is needed IMO.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: (!!!) Improving NGUI: Voice your opinion
« Reply #204 on: January 31, 2014, 12:29:10 PM »
Yes, but what would set those parameters, exactly? Events are generic. They don't know anything about your buttons or where they come from.

You could simply name your buttons properly. Or attach a data script:
  1. using UnityEngine;
  2.  
  3. public class MyButtonData : MonoBehaviour
  4. {
  5.     public int buttonIndex = 0;
  6.     public string someCustomValue = "abc";
  7. }
...then all you need to access it in your OnClick callback is:
  1. MyButtonData data = UIButton.current.GetComponent<MyButtonData>();
  2. Debug.Log("Clicked on button " + data.buttonIndex + " with value of " + data.someCustomValue);

jingato

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 15
    • View Profile
Re: (!!!) Improving NGUI: Voice your opinion
« Reply #205 on: January 31, 2014, 01:30:31 PM »
Yes, but what would set those parameters, exactly? Events are generic. They don't know anything about your buttons or where they come from.

You could simply name your buttons properly. Or attach a data script:
  1. using UnityEngine;
  2.  
  3. public class MyButtonData : MonoBehaviour
  4. {
  5.     public int buttonIndex = 0;
  6.     public string someCustomValue = "abc";
  7. }

...then all you need to access it in your OnClick callback is:
  1. MyButtonData data = UIButton.current.GetComponent<MyButtonData>();
  2. Debug.Log("Clicked on button " + data.buttonIndex + " with value of " + data.someCustomValue);


That's just the thing I'd rather avoid though. I would rather just have a method like OnItemSelected(int itemNumber) and in the inspector select the method from the drop down ans enter the number. I attached an example of this around page 2 of this thread I think. Or maybe just have an Object field on the UIButton that we can set some arbitrary data to.

Another thing I really would like to see is some improvements to the new anchor system. I found the new system a bit confusing but I'm starting to understand it now. I think it really lacking the ability to set you're anchors as percentages instead of pixels. Unless I'm just missing something. For example, I wand to have a group of labels placed horizontally in a row and have them evenly spaced based on the screen width. I can't seem to find a way to do it.

**EDIT** I figured out how to layout the buttons evenly by using custom as the anchor choice. It's not very cleat that that's what it does though and hard to figure out how to use properly. Plus if you decide to add another item later you will need to go over all the other items and update there anchor values to fit the new one in., which which makes it a pain...I could write code to adjust all the anchors at runtime, but If I'm doing that then I mine as well just position them myself.
« Last Edit: January 31, 2014, 02:38:12 PM by jingato »

KyleStaves

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 13
    • View Profile
Re: (!!!) Improving NGUI: Voice your opinion
« Reply #206 on: January 31, 2014, 03:56:28 PM »
Is the Widget Wizard being abandoned/depreciated? I kind of hope not (as I don't like having to pull the Examples in to every project) - if so it would be good to know so I can be sure to pull examples in and start using the new approach.

If not would it be possible to get the UIImageButton creation updated so that the UIImageButton script is on the Sprite and not as a parent of the Sprite? The default method of creation (collider / ImageButton script on parent, sprite and label as children) doesn't work well with the new anchoring system / collider maintain size methods.

Thanks either way!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: (!!!) Improving NGUI: Voice your opinion
« Reply #207 on: February 01, 2014, 01:29:35 PM »
You can set the UIImageButton's 'target' to be the sprite itself. In fact it does just that on its own if you leave it as 'null'.

I'll be removing that script in the future though. It will become a part of UIButton.

Anomalous Underdog

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 6
    • View Profile
Re: (!!!) Improving NGUI: Voice your opinion
« Reply #208 on: February 03, 2014, 12:17:07 PM »
I did my best in reviewing this thread but apologies if I missed anything & post something that's been addressed already.

I've used NGUI (an old version) in a released game already so I have a little bit of experience with it. I have to say though that most of what I learned is only through trial-and-error. The guide in this website (at least last I checked) seemed to be for an older version. And most of the tips and tricks could only be found by looking through forum posts.

The video tutorials are nice, but we have slow Internet connection here in my country that it's not ideal.



UIButton has event for OnClick in what seems to be an entirely new system (dropdown box to choose which function to call)

However it only has event for OnClick. When I need to listen to OnPress and OnRelease of a button I need to use UIButtonMessage. It's kind of a redundant component. I'm guessing this is due to some transition.



Data binding example use case: bind my character's health to a progress bar's (i.e. health bar) value (complete with tweening animation for the bar's width & particle effects, when the player's health value changes).

Imagine doing that without coding, or little coding that you need to write at initialization only, without having to write a new class for every little thing you come up with. The point is faster, rapid ways to prototype GUI designs for a game. Something you could let GUI designers (who have little to no knowledge in coding) in your team dabble at for experimentation.
« Last Edit: February 04, 2014, 01:17:57 AM by Anomalous Underdog »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: (!!!) Improving NGUI: Voice your opinion
« Reply #209 on: February 04, 2014, 03:13:45 AM »
To get events for OnPress, OnClick, etc -- you can either write scripts with those functions, or attach UIEventTrigger to your button.

The updated NGUI documentation page is here: http://www.tasharen.com/forum/index.php?topic=6754.0