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

Pages: [1] 2
1
NGUI 3 Support / Invisible Button in 2.6.4
« on: May 02, 2014, 11:00:41 AM »
I am using NGUI 2.6.4 (upgrading this particular project has been too difficult). Anyway I need a button that you can't see, that stretches across the whole screen. Previous I have been using a solid white sprite that I set transparency to 0 on for this. But I worry that I'm paying a cost for that. In recent versions of NGUI this is easily solved, but in 2.6.4 is not very obvious. If I just stick a collider on gameobject...it won't work...unless there is some sprite in there somewhere. I have found 2 ways...

1: use the typical sprite with collider with uistretch approach, but set the sprite's atlas to null. This seems to work.
2: use a label, uistretch, collider, set font to null. This also seems to work.

Are either or both of those ok? Is there a better way (that works in 2.6.4)?


2
NGUI 3 Support / full screen transparent button
« on: February 10, 2014, 11:10:49 AM »
I needed a way to detect that the user touched the background (camera based app) so I used a UISprite, pushed it back into the z, stretched it to the screen size and set the color alpha to 0, collider, messager, etc. Works. On mobile are there any performance concerns of having a fullscreen transparent sprite? Or, is it actually not redrawing the screen since it's completely invisible?

3
NGUI 3 Support / Re: New NGUI user/android questions:
« on: November 19, 2013, 02:32:18 AM »
I found that once you learn NGUI, doing most things is pretty quick. But, if you're doing anything even a little interesting with the UI then the initial mastery is deceptively extensive. For every major UI feature you'll get 99% of the way there in 10 minutes, then spend a day or 2 learning something subtle about it for the last 1%. But this doesn't mean you shouldn't use it. The value is really the draw calls management, which is pretty critical on Android.

4
NGUI 3 Support / Re: UITable Padding Setup and CenterOnChild delay
« on: November 19, 2013, 02:21:13 AM »
I have this almost solved.

I don't know why I didn't think of it before...I'm just having the table adjustment script call the centeronchild method instead of the centeronchild calling itself on enable (it still calls itself on drag though). For springing panels this works perfectly. I still have one nagging issue that one of my panels, which needs to spring instantly (set to strength 1000), there is one frame where you can see it move around/adjust itself before it looks right.

I am happy enough with it now to move on, but later during polish phase I will probably want to fix up that one frame bit somehow.

5
NGUI 3 Support / UITable Padding Setup and CenterOnChild delay
« on: November 18, 2013, 09:29:12 PM »
So I have a completely dynamic UI. Must work on various sized devices (Android). To do that, I am often using anchors and stretches because they can function on relative space.

However, with tables the padding is in pixels instead of something relative so I've needed to write some code to step into the table at runtime and tweak things based on the device surface (after initialization, change padding sizes based on screen size and item size, which is also dynamic). So far so good. The issue comes whenever I try to do something very soon after the table gets enabled.

CenterOnChild for example. It's always a little "off". I noticed that if I just let it center itself twice, it would fix the error. Then I realized what's happening is that the padding updates just weren't quite finished. To fix this, all I've found so far is that I can delay the CenterOnChild for 0.2 seconds, then everything is fine. But that's so hacky and you can see the pause. I've tried narrowing in on the delay, but I worry I'll get timing issues on different devices. I wish I had some way of knowing precisely when I can call CenterOnChild, or if relative padding was built into the UITable.

Another solution I've thought of is silently enabling all the UI at once so these padding updates and various other fixes can "take" to the dynamic UI before I need to really display it (and before it needs to move correctly). That also feels like a hack though so I figure I'd post about it and see what others think.

ps: My feature request: Everything in NGUI that has a pixel setting, should also have a relative method of setting the same thing, and vice versa.

6
NGUI 3 Support / Re: draggable panel start position
« on: November 18, 2013, 09:09:21 PM »
That works. Thanks.

7
NGUI 3 Support / draggable panel start position
« on: November 18, 2013, 06:01:22 AM »
Draggable window starting position

I'm using a draggable panel and the centeronchild together. I have figured out how to pass some index to centeronchild to have it spring to that position..but, I need the panel to start in a default position without springing to it.

8
NGUI 3 Support / Draggable Panel current position
« on: August 21, 2013, 01:05:12 PM »
I'm building a UI very similar to the draggable panel example. Redundant to the drag, I also have some left and right arrow clickers that need to move the table back and forth. I've figured out how to spring the table to a particular item position. But the problem is I can't figure out how to determine the current position of the table (since the user can drag it without using the clickers). A typical scenario might be that a user drags the table to item 3, but then clicks the right arrow which should advance it to item 4 (knowing that it was left resting at item 3).

9
NGUI 3 Support / Re: best practices for NGUI across scenes?
« on: July 04, 2013, 01:56:55 AM »
So I noticed that I had a handful of things that I needed to persist across level loads. But this script either creates duplicates (the first one) or kills off everything except for one thing (the second one). I figured the simplest solution was to put everything I wanted to persist under a single game object. It feels weird since that collection of objects aren't normally related to each other, but I can't think of any problems so it seems ok.

10
NGUI 3 Support / Re: best practices for NGUI across scenes?
« on: July 03, 2013, 11:50:32 PM »
Nice. This was my first time needing to have different scenes in a project and so I wasn't even aware of dontdestroy...I'll try it out. Thanks!

11
NGUI 3 Support / best practices for NGUI across scenes?
« on: July 03, 2013, 07:46:28 AM »
In a way this is almost a general question about Unity development. The situation is that I want (or assumed I should) several scenes that hold my levels for a game. Each scene file in Unity is a level with geometry, particle systems, NPC setups, etc.

Anyway, the NGUI portion of the project is fairly complicated with a deep hierarchy and dozens and dozens of settings. I realized that if I needed to make a change to the GUI, I'd need to change it in all of the scene files. So I figured I could stuff the whole NGUI tree into a prefab. Then I can just edit once instance and have the changes propagate everywhere. This seems to work.

I just wanted to ask, is this the best way to handle it?

12
NGUI 3 Support / weird border around my sprite
« on: July 02, 2013, 02:28:05 AM »
Just a simple squared sprite that I am stretching to fill an area. It has a pixel border added to it. It's not in the source file. I read about this issue for tiledsprites, but the solution didn't work for a regular sprite. I couldn't find a solution for a regular sprite.

13
NGUI 3 Support / Re: UIStretch Oddities
« on: June 28, 2013, 12:07:27 AM »
Yea that's basically what I did (i peaked inside that method and pulled out the bit I needed). Any thoughts on the flickering?

14
NGUI 3 Support / Re: UIStretch Oddities
« on: June 27, 2013, 05:28:39 AM »
I got the colliders working using a similar solution.

But, I still don't know what to do about the flickering. An easy way to show the bug is to make an imagebutton that uses all the same image for the various states, then stretch it.

15
NGUI 3 Support / UIStretch Oddities
« on: June 27, 2013, 03:09:31 AM »
Lets say I want to scale a button so I use a UIStretch. If I scale the background component of the button it's fine. However, then the collider doesn't get scaled and I wind up with a buggy button. So I put the UIStretch on teh button instead of just the Background texture...but now the button becomes enormous....not sure how big but looks like several hundred times larger than the screen. So...how is this supposed to work?

And btw - ImageButtons that have their images scaled, flicker when pressed (I suspect because the "pressed" image comes in, then later gets scaled instead of coming in already scaled).


Pages: [1] 2