Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Topics - nah0y

Pages: 1 [2] 3 4 5
NGUI 3 Support / Addons to UILabel
« on: December 27, 2013, 05:42:15 AM »
Hello !

Currently on a slider, we can have a OnValueChange. If we drop a UILabel on this, we have some methods at disposal, such as UILabel.SetCurrentPercent.
It would be nice to have so more options here, such as SetCurrentValue and SetCurrentStepValue.

I added them on a different script that I attach to my label, but I think it would be nice to have them by default no ?

  1. public void setCurrentStepValue()
  2. {
  3.         if (UIProgressBar.current != null)
  4.         {
  5.                 m_label.text = (m_startingValue + Mathf.Round(UIProgressBar.current.value * (UIProgressBar.current.numberOfSteps - 1))).ToString();
  6.         }
  7. }

  1. public void setCurrentValue()
  2. {
  3.         if (UIProgressBar.current != null)
  4.         {
  5.                 m_label.text = UIProgressBar.current.value.ToString("f1");
  6.         }
  7. }

NGUI 3 Support / Using simple sprite with anchors
« on: December 19, 2013, 04:44:47 AM »

Let's say I have a UIWidget with anchors on it, so that it's size changes when the screen size changes.
So I could have this widget with a size of 100x90, and with a lower screen size, a size of 50x25.

If I have a sprite, as a child of this UIWidget, which size is 80x80.
It will render nice inside the first size, because it fits, but for the second size, it will be too big :/

So the question is : How to automatically resize the sprite so it keeps its ratio?

NGUI 3 Support / NullPointer using ScrollView
« on: December 17, 2013, 05:41:54 AM »
I have a scrollview with a vertical scrollbar.
The GameObject holding everything is disabled in the scene, and in the code, when I'm calling "m_scrollView.ResetPosition()" I have a null pointer.

Here's the stacktrace :
UnityEngine.Component.get_gameObject ()
UnityEngine.Component.GetComponentsInChildren[UIWidget] (Boolean includeInactive)
NGUIMath.CalculateRelativeWidgetBounds (UnityEngine.Transform root, UnityEngine.Transform child, Boolean considerInactive) (at Assets/NGUI/Scripts/Internal/NGUIMath.cs:376)
NGUIMath.CalculateRelativeWidgetBounds (UnityEngine.Transform root, UnityEngine.Transform child) (at Assets/NGUI/Scripts/Internal/NGUIMath.cs:367)
UIScrollView.get_bounds () (at Assets/NGUI/Scripts/Interaction/UIScrollView.cs:161)
UIScrollView.SetDragAmount (Single x, Single y, Boolean updateScrollbars) (at Assets/NGUI/Scripts/Interaction/UIScrollView.cs:463)
UIScrollView.ResetPosition () (at Assets/NGUI/Scripts/Interaction/UIScrollView.cs:527)
here is the call to ResetPosition

NGUI 3 Support / TweenPosition and new Anchors
« on: December 17, 2013, 05:22:10 AM »
Hello !

Is there a way we can tween the position of a panel or group of widgets that are using anchors?

What I've done, is create at the root of the window I want to move, an empty GameObject with a TweenPosition and a UIWidget.
And everything beneath the UIWidget will use anchors on this empty gameobject (so everything is based on the dimension of this UIWidget).

It's working fine like this, but !
I can't specify the size of this UIWidget to always be the size of the screen for example.

I think the solution is to have a script on this UIWidget that will set the dimension of it to the screen size at startup and then do nothing else.
What do you think?

If it's a solution that works, why not add a bool on the new anchor types with "run only at startup" as you did with last anchors?

NGUI 3 Support / Best NGUI hierarchy?
« on: December 17, 2013, 05:17:00 AM »

Small question, what do you recommend doing as a hierarchy for a window for example.
We can do multiple things such as :
1) Empty GameObject
- MyWindow (empty)
-- Background (sprite)
-- ScrollView
-- etc...

2) What you do in your videos
- MyWindow (the background sprite)
-- ScrollView
-- etc...

It seems that the second approach as the advantage with anchors, cause if I set an anchor on the scrollview, it will automatically be based on the background, which is not true for the first one.
But it seems weird to have a parent that is a background sprite... no ?

NGUI 3 Support / Panels no longer by default?
« on: December 16, 2013, 04:57:55 AM »

I'm now using NGUI 3 and creating a 2D UI I no longer have the default Camera > Anchor > Panel. I just have the Camera.
Does that mean we don't need to put things under Panels anymore by default?

I can just create Empty Game Objects to arrange things and use panels only if needed?


NGUI 3 Support / Move Examples to Editor folder
« on: December 16, 2013, 04:44:45 AM »

Just a suggestion. Why don't you move the Examples folder under an Editor folder so that it's not included in the final build of everyone?

NGUI 3 Support / Small error in release notes?
« on: November 25, 2013, 04:23:42 AM »
- NEW: You can now find an assortment of ready-made controls ready to be drag & dropped into your scenes (search for "Wooden").

You mean "Controls" instead of "Wooden" right?

NGUI 3 Support / OnConstantPress event ?
« on: November 19, 2013, 09:47:23 AM »

It seems weird but... I can't find anywhere an event that will be call every frame while the user is pressing a button. Am I missing it?


NGUI 3 Support / Best way to make resolution independent UI
« on: November 19, 2013, 05:27:33 AM »
Hello !

Let's say I want to make this UI :

Each blue rectangle must have a width and height in % of the screen.
And inside each blue rectangle, I want to be able to add whatever I want, a single sprite, a sprite + label, a button etc... and I want it to be centered and not streched or whatever inside the blue rectangle, just resized.

How would you do that ?

NGUI 3 Support / UIPanel static with parents
« on: June 21, 2013, 09:34:43 AM »
Hey! Long time no see :)

First, congrats for the 2.6.3 release, it really improves performances!

I'm trying to improve that more with setting some UIPanels as static, but!

If I have :
UIPanel 1
- UISprite
- UILabel
- UIPanel 2
-- UISprite

If I set the UIPanel1 as static, can I have things moving under the UIPanel2 ?
And, can I move the UIPanel 2 itself? (I don't think I can for this one).

Thanks ;)

NGUI 3 Support / Super Kiwi Castle Run
« on: April 17, 2013, 05:11:25 AM »
Hey guys!

Just wanted to let you know that the game I've been working on for mor than 1 year is finally out on the AppStore worldwide!
You can check it out right here :

ALL of the UI you see in the game has been done using NGUi, so thanks ArenMook for all the help on the forum and for the plugin ;)

Tell me what you think of it!

NGUI 3 Support / UILabel Shrink
« on: April 03, 2013, 12:28:10 PM »

With the latest update (2.5.1), you've added the possibility to shrink a label if the text is larger than the maxSize.
It's working great, but... only for single line labels.

Let's say I have a label, that has a max size of 250px.
If I want this label, to stop at the end of the 250px and go on on the next line, I just do nothing. It works (ok, normal).
If I want it to stop, and takes only 4 lines, I should just set the max lines to 4, and the text should shrink just a little, so that it fits in 4 lines. Right now, the problem is that, if you shrink it, it will try to fit everything on a single line, and display a really tiny label, even if I want it to be on 4 lines :(

Is there any way to fix that ?

Thanks !

NGUI 3 Support / Update UIFont with config file
« on: March 28, 2013, 09:34:57 AM »

A few weeks ago, we could update a UIFont prefab just by drag&drop the config (txt) file onto a field in the UIFont inspector, and it would update the entire font and fix it.
The field is not here anymore :/

I'm using TexturePacker to create my atlases, and it was the way I updated fonts, now the only way I can make them work, is to use the NGUI atlas maker.

Is there a reason you removed this config file field ?


NGUI 3 Support / Pixel Perfect broken
« on: January 29, 2013, 10:25:57 AM »
Hi !

Long time no see :)

Just to say that with the new version, the pixel perfect is broken, if I take a UILabel and keep pressing the Make Pixel Perfect button, it will go down of 1px at every press of the button.

So if you're like mean, and doing a lot of Alt+Shift+P to make everything pixel perfect, your hole UI will go down... :(

It happens with this hierarchy :
#2D UI# (0, 0, 0) <- position
  Camera (0, 0, 0)
    Anchor (0, 0, 0)
      Menu (0, 0, 0)
        MenuGame (0, 0, 0)
          InfosRight (512, 310, 0) (no script attached to this GameObject)
            LabelCoinCount (-63, -30.5) <- this one keeps going down with each press
            Sprite (common_coin_small) <- this one does not move

Pages: 1 [2] 3 4 5