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.


Messages - finky45

Pages: [1]
1
NGUI 3 Support / Re: Dreaded question (regarding event bubbling)
« on: June 18, 2014, 12:28:06 PM »
"(via Input as normal)"

Can you elaborate on this? What would code look like in a OnClick() function in the invisible widget to pass it further down?

2
NGUI 3 Support / Dreaded question (regarding event bubbling)
« on: June 17, 2014, 02:52:41 PM »
From what I read looking at posts it's not possible to do event bubbling with NGUI. Is it?

Imagine an RTS. You need to drag the view around with OnDrag events, but at the same time allow OnClick events on your scene game objects. The problem is you have colliders stacked on top of each other and only the top one gets the event.

I put an invisible widget in the GUI to catch OnDrag events, and OnClick events on my scene game objects. None of the events get passed the invisible widget's box collider which takes up the whole screen. Other than putting OnDrag functions on all my game objects and doing away with the invisible widget, is there a more elegant solution to this? I can't afford waiting for the new uGUI to come out (which supposedly has bubbling)

I was thinking of artificially creating an OnClick event and passing it futher down to the 3D scene but I don't know how to do it. This must be a common issue, how do people get past it?

3
NGUI 3 Support / Re: BMFont + TexturePacker + NGUI = offset problem
« on: March 06, 2014, 12:22:36 PM »
It seems that I have an older version of NGUI because the process differs slightly from your video (thank you for taking the time to make it, I really appreciate it). Maybe there was a bug or something in my version because I'm following the same procedure. We'll see.

Edit: Well after closing Unity and opening it the font appeared coorectly o.O I guess we can call this solved but I don't know why/how it got fixed. I still have to update NGUI so I will be doing that later...

4
NGUI 3 Support / Re: BMFont + TexturePacker + NGUI = offset problem
« on: March 06, 2014, 11:32:19 AM »
The FNT file shouldn't have to know anything about an atlas, because there is no atlas.

Yes, this is exactly what I said  ::)

Atlas gets created from the FNT file and the exported texture. The texture's size should not be modified between the export from BMFont and the creation of an NGUI font.

This is correct.

Once the font has been created and chosen to be added to an atlas, NGUI automatically switches to using the sprite within the atlas rather than the original texture. And the sprite does have the offset you're talking about.

The sprite has the offset but the individual letters are still bound as if the sprite was a single texture!!!!! It's looking for them in the wrong part of the atlas they are further down. Why is it so hard to understand?



5
NGUI 3 Support / Re: BMFont + TexturePacker + NGUI = offset problem
« on: March 06, 2014, 10:58:44 AM »
1. Export your font from BMFont, generating a FNT file and the associated texture.
-Done that, it was the easy part. BMFont doesn't and can't possibly know ahead of time where the final sprite will be located in an atlas. Therefor the x and y coordinates are as if the font sprite was by itself.

2. Use the Font Maker in NGUI to create your font, adding it to the atlas as desired.
-I tried this and it produced the same problem, except that it moved the sprites around the atlas.png in a different manner than TP.

The problem is simple as stated above: the font.fnt file doesn't take the global sprite offset into account after it's added to an atlas. The x and y coordinates in the .fnt file at 0,0 where the font sprite in the atlas is further down at around 0,400.

6
NGUI 3 Support / BMFont + TexturePacker + NGUI = offset problem
« on: March 06, 2014, 10:01:44 AM »
I am using a single atlas that contains all my menu graphics, as well as the font I am using for the game. The problem is that the Font Descriptor file (TextAsset) created by BMFont does not take into consideration the offset in the atlas. So NGUI renders random parts of my image. I looked in the examples provided with NGUI and noticed that the Font Descriptor file has a global offset already added to the x and y coordinates. How do I add that offset to the descriptor file without manually editing it?

I found no such option in BMFont and I don't know if TP can do that work for me. The funny thing is NGUI shows the correct area for the text in the preview. If I could just specify an offset or have it intelligently render it (atlas xml offset + font x,y = correct letter coordinates) that would be great.


7
NGUI 3 Support / Scaling based on DPI
« on: January 13, 2014, 08:14:10 AM »
So I am trying to make a universal GUI (just 3 simple buttons) to scale dynamically based on the DPI of the mobile device. There is nothing else but 3 buttons and I can't get them to scale (they just remained fixed in pixels). Is there documentation how to accomplish DPI scaling?

Pages: [1]