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 - vexe

Pages: 1 [2] 3 4
Hey guys,

so I watched the "how to make a modular UI" video, and I quite like it.

My attempts have been successful, at creating even more complex UIs than the one presented in the video.
But one thing I failed to "modularize", is the clipped panel.

So let's say I have an inventory with an inner window for my contents (see attachment), what I'd like to be able to do, is resize the inner window, and have the clipped panel resize itself accordingly and correctly.

I tried doing the same thing, attaching a UIAnchor and UIStretch scripts to it, but it didn't work, it didn't resize properly.

And it is really annoying to having to resize it every time I resize my windows, especially since it's a clipped panel.

Thanks for your time and any help or suggestions.

Hey guys,

so this is like, the 3rd NGUI bizarre thing happening to me today.

I have two inventories/itemBoxes with their Z position set to 0 - and my UICamera eventType is "UI" - Which means that what you see in the attachment, is not a strange thing - Since UI eventType handles things via depths, and not Z.

Here's the thing: If I change the Z of the grey item box to be in front of the black one, it will go actually and be in front of it blocking it, so there's no intersecting between them, the grey one just sits on top of the black one, shouldn't this NOT happen? (see attch2) - Not just that, if I do the opposite and try to put the black one in front, I can't! (see attch3)

Not just that, here's one more :D - If I change the eventType to "World", it doesn't change anything! - The issues will remain, and changing the Z will have the same effects as in the last 2 situations!

I'm really lost here, I'm pretty sure that I'm not using any transparent material in the black inventory, and the alpha is full.


Any help, advice or explanation would be appreciated.

Thanks a lot.

EDIT: I know you'd tell me, that since I'm using UI as an eventType, I should be adjusting the depths. Yes, correct that works, but:

1- I was just wondering why this is all happening to me, since it shouldn't.
2- The two inventories (the black and the grey) are of a different panel (if that matters) - if I keep adjusting depths, this means that I have to keep track of all the depths! So like for the first inventory say I had background on 0, slots on 1 and labels on 2. In the 2nd inventory I'll have background on 3, slots on 4 and labels on 5! - This is annoying!

Please provide us proper ways to deal with this, as there is very little information about this. - The comments on the code doesn't clear all that much, and the online documentation was always known to be developer-oriented much more than user-oriented.

Hello guys,

I saw the NGUI modular UI video and I decided to make my UIs modular as well.

The positioning and resizing/stretching worked very well. But there's something not right when I resize the original main background, the childrens' Z depth increases! I have no idea why.

I have made a video for it, please have a look

I'm using 3.0.4

Here's my setup:

  1. (Panel) - ItemBox
  2. - Main Window (Empty game object)
  3. --- Background - Outer (this is the background that I resize, and with it everything resizes)
  4. --- Glow - Outer (Has a UIAnchor and UIStretch (both) with "Background - Outer" as a container)
  5. --- Content Window
  6. ----- ItemBox (has an ItemBox script)
  7. ------- Items Window (Empty GO)
  8. ---------- Background - Inner (Has a UIAnchor and UIStretch (both) with "Background - Outer" as a container)
  9. ---------- Glow - Inner (Has a UIAnchor and UIStretch (both) with "Background - Inner" as a container)
  10. ------- (Panel) - Clipping (Has a UIAnchor and UIStretch (both) with "Background - Inner" as a container)
  11. ---------- Items (Empty GO)
  12. --- Title Bar
  13. ----- Background (Has a UIAnchor and UIStretch (horizontal) with "Background - Outer" as a container)
  14. ----- Buttons (Empty GO)
  15. ------- Close (Has a UIButton UIAnchor with "Background" (the previous one) as a container)
  16. ------- Sort  (Same)

NGUI 3.0 is really awesome, but still there are some things I'm failing to do well, maybe it's just me.

Thanks a lot for your help.

NGUI 3 Support / [SOLVED] UI vs World eventtype issue
« on: November 08, 2013, 09:03:43 PM »
Hey guys,

from what I know about those two eventtypes, UI is for the 2d UI, and world is for the other game camera.

Now, the problem is, is in my in my inventory UI, when an item takes more than one slot to fit, (like 2x3: 2rows, 3cols) I leave the topleft widget active, adjust its UISprite dimensions, and for the rest of the slots, I just disable their UISprite (not the whole slot) - in other words they still have their colliders active on them. (see attachment) - but for some reason, when I do that and I'm on UI eventtype, it doesn't seem to detect events anymore. If I switch to world, it works!

How can I fix that? I still want the UI mode, but I also want my inventory to work (please don't suggest to use one collider, it doesn't work for my purposes)

One thing i could do, is leave everything as is, but just set the alpha to 0 for the slots I want to hide. But I believe there's something better.

Any ideas?


EDIT: It seems that setting the alpha to 0, isn't a great solution.

Hi, when I upgraded to NGUI 3.0.2 from 2.6.4 - I had some extra stuff, in some NGUI files. For example a 'saturation' property in UIWidget, 'GetMouseClick' in NGUITools, etc. When I upgraded, of course, I have to copy paste the functionality and move it again to the new files. Not very efficient.

What's the best way to tackle this problem?

I guess, maybe for the saturation, I could have some extension methods, like a static class UIWidgetExtensions, and put the stuff there in a separate file so that it won't get harmed?

But what about, static functions, like the one I had NGUITools.GetMouseClick - Extension methods won't work here, so I guess, I have to create my NGUIUtility and put my stuff there?


Thanks for any tips :)

NGUI 3 Support / [SOLVED] Very annoying: can't move when focus on widget
« on: October 27, 2013, 10:14:30 AM »
I was really hopping this would come to an end when I upgraded to 3.0.2 but obviously it's not.

If I click on a widget (say sprite) and press F to focus on it, I can't move, I can't do anything, no Right click navigating with the mouse, no WASD editor movement, etc. The only way to free myself is to unselect the widget - Select something otherwise, something that's not a widget.

Am I missing something? or this is just the way it is... ? :(

That was ambiguous, see attachment.

The way the titles, their durations and albums are organized, much like a list view in a winform app.
If you click a title, all the line will get highlighted no matter where you click, on the title's name, duration or album.

I'm trying to create a media player, that's why I'm asking.

How to create a list view similar to VLC? what should I use? how should I create that type of button, where if you click on any of its parts, all get highlighted?

Thanks a lot.

Hi, I wonder how I could resize a window in NGUI. Like, in Windows for example, if you place the mouse on the borders of a window, you could mess with its dimensions, resize it, etc. NGUI allows you do this easily in the editor while you're creating your widgets, but I want to do this in-game.

Any ideas?


I've seen the upgrading videos. But in my case, everything is so screwed up I can't do a thing :(

Look at my inspector and atlas maker in the attachment, this happened immediately after I tried to use my UI atlas, that I had created previously. Is there a problem doing that? Atlases are now somehow different? I still have the atlas material and texture intact though... not sure what I can do with it now, maybe create a new atlas, with the material? how? but now I can't since I don't even have the atlas maker working...

Now I can't even undo this screwed up inspector and atlas maker, please help.


[EDIT]: seems like if I restart Unity, the inspector and atlas maker goes back live (AS LONG AS I DON'T SELECT THE OLD ATLAS AGAIN). But still, how can I use my old atlas? do I have to extract the sprites, and then add them again one by one? can't I just reuse my old stuff?

[EDIT]: I tried creating a new atlas, and specifying my old material, now when I tell a widget to use the atlas, it says there's no sprites found :(

NGUI 3 Support / Can I sell an asset, that I made with the non-free NGUI?
« on: October 20, 2013, 05:04:20 AM »
Hi, I just saw this asset here
If you flip through the images, you'll see that NGUI is being used. Now the question is, am I allowed, to use my (paid) NGUI version, to create assets/packages, etc, and then sell them? My guess is, that I can't, but I'm just wondering what that guy did, to get his asset online with NGUI, could it be that he's using the free version? but I don't see any watermarks, that's why I'm asking...

And if I can't, what if I encrypted the NGUI folder/files in someway? and only unencrypt, when the code needs to access something? Idk, just guessing...

Thanks for any info.

NGUI 3 Support / CLASSICAL Resident evil "Turn page" effect for UILable?
« on: September 25, 2013, 08:45:24 AM »
So, I'm really happy with the Typewriter effect, now I'm looking for a "turn page" effect, just like here:

I'm working on a text-viewer for my file manager, where you could seek through pages and text files within the current folders, when I turn pages I want to have that rolling/turn page effect as in RE, how can I do it? - Thanks.

I just added a new atlas when I noticed the quality of my UI atlas has drastically dropped! (See the rough edges in the attachment) This is really frustrating, this is the 2nd time it happens.

Any idea how to fix this? what's the cause of this? and how to prevent this from happening in the future?

-- Thanks.

NGUI 3 Support / [SOLVED] Something wrong with these FadeIn/Out methods?
« on: September 24, 2013, 11:05:28 AM »
I wrote a method to animate a panel's widgets alpha:

  1.         public static UITweener AnimateAlpha(UIPanel panel, float animTime, float from, float to)
  2.         {
  3.                 int len = panel.widgets.size;
  4.                 if (len > 0)
  5.                 {
  6.                         for (int i = 0; i < len-1; i++)
  7.                         {
  8.                                 var w = panel.widgets[i];
  9.                                 TweenAlpha.Begin(w.gameObject, animTime, to);
  10.                         }
  11.                         return TweenAlpha.Begin(panel.widgets[panel.widgets.size - 1].gameObject, animTime, to);
  12.                 }
  13.                 return null;
  14.         }

And this (which I give it something like myPanel.GetComponentsInChildren<UIPanel>() just to go recursively down):

  1.         public static UITweener AnimateAlpha(UIPanel[] panels, float animTime, float from, float to)
  2.         {
  3.                 int len = panels.Length;
  4.                 if (len > 0)
  5.                 {
  6.                         for (int i = 0; i < len - 1; i++)
  7.                         {
  8.                                 var panel = panels[i];
  9.                                 AnimateAlpha(panel, animTime, @from, to);
  10.                         }
  11.                         return AnimateAlpha(panels[panels.Length - 1], animTime, @from, to);
  12.                 }
  13.                 return null;
  14.         }

I use it like this:

  1.         private void FadeIn()
  2.         {
  3.                 float from = 0.01f, to = 1f;
  4.                 inventoryPanel.gameObject.SetActive(true);
  5.                 UIWidget.AnimateAlpha(inventoryPanel.GetComponentsInChildren<UIPanel>(), animTime, from, to);
  6.         }
  7.         private void FadeOut()
  8.         {
  9.                 float from = 1f, to = 0.01f;
  10.                 UIWidget.AnimateAlpha(inventoryPanel.GetComponentsInChildren<UIPanel>(), animTime, from, to).onFinished += OnFadeOutFinished;
  11.         }
  13.         private void OnFadeOutFinished(UITweener tweener)
  14.         {
  15.                 inventoryPanel.gameObject.SetActive(false);
  16.         }

Now it works well when fading out, however when fading in things go a little bit funky, and strange, the panel gets active, I see the widgets alpha at full, but I don't see them. They become visible only when I hover over them (See attachment)

Any idea what's going on? - Is there a better way to fade in/out?


I wanna be able to know if I was using the right or left mouse button when I'm done dragging an item (dropping it), how can I do that? (in other words I wanna know if I was using the right/left mouse button to drag)

currentTouchID doesn't work I guess...

any ideas? - Thanks a lot.

NGUI 3 Support / Extract sprites from existing atlas?
« on: September 16, 2013, 03:29:20 AM »
I'm making separate atlases for my game. I'm intending to make a "UI" atlas, that stores all the sprites I need for buttons, glow, highlights etc. The ones I like the most were in the "Wooden" atlas, I also like some other from other atlases. How can I extract the ones I want? if that's possible.

To recap: I have different atlases, I want to extract some of their content (ones I like) and combine into one atlas.


Pages: 1 [2] 3 4