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

Pages: [1]
1
NGUI 3 Support / Re: Optimization Issues (here's what profiler shows)
« on: November 04, 2014, 10:32:14 AM »
I see, so all's done the way it should be then.
Thanks, useful to know that the first time one enables a widget, all this is going on. Might be a good idea to enable everything on game startup and disable whatever's not needed just to be safe.

2
NGUI 3 Support / Optimization Issues (here's what profiler shows)
« on: November 03, 2014, 11:53:23 AM »
Hi,

I've been having some lag issues on the iOS devices (it's not really noticeable on PC).

My situation is the following:
I have an invisible widget (Let's call it "Game") that has a lot of children.
More specifically "Game" has 90 invisible widgets as children which in turn each have their own children and all those also have a collider on them because they need to be buttons. In case you're wondering why the hell I'd need 90 buttons on a regular UI, it's a board game made in NGUI.

There's a function that programmatically generates the aforementioned "Game" gameobject and this function is called in Unity's Awake().
The "Game" gameobject itself is inactive at the start but the generation happens nonetheless without a problem.
When the player presses play, that's when the "Game" gets activated and that's when I get a huge spike in profiler and a lag on devices.
In profiler, it says that UIWidget.CreatePanel()'s and UIPanel.UpdateSelf() are responsible for this lag.

I'm attaching a profiler screenshot below in hopes that someone can explain to me what am I doing wrong optimization-wise.
Is NGUI not designed to handle such amount of widgets at once or am I the one to blame for not using it correctly?

P.S. I did find a work around by having "Game" enabled at the beginning and disabling it at the end of the first Update() cycle, but I would still like to understand NGUI better and prevent such cases from happening in the future.

Thanks

3
NGUI 3 Support / Re: How to ResetToBeginning using UIPlayTween?
« on: October 16, 2014, 07:41:43 AM »
ah, I was thinking in a wrong way, thought there's a UIPlayTween command for that :D
Thanks!

4
NGUI 3 Support / Re: How to ResetToBeginning using UIPlayTween?
« on: October 15, 2014, 07:17:17 AM »
I'm using groups of course. My situation is the following:
I have a game object which has four tweens on it, grouped 0,1,2,3.
I want to reset tween 0 and tween 2 to the beginning at a certain time.
If I had just one tween on that game object, I'd use GetComponent<TweenScale>().ResetToBeginning();
But since I have four difference tweens and out of those four I want to reset only two I can't use ResetToBeginning, so my question is, how do I reset them?

5
NGUI 3 Support / How to ResetToBeginning using UIPlayTween?
« on: October 13, 2014, 06:30:18 AM »
Hi,

Can you please tell me how to use ResetToBeginning on all the tweens that are on one game object? I know there's a ResetToBeginning when dealing with an individual tween but how do I do this through UIPlayTween so that I can reset tweens selectively that are on one game object?
Is what I'm looking for ResetIfDisabled? I don't quite understand the explanation "Whether the tween will be reset to the start if it's disabled when activated."

Thanks

P.S. GetComponent<UIPlayTween>().Play(false); <--- is it right to use this to PlayReverse or it's better to change the play direction to reverse and play it with Play(true)?

6
NGUI 3 Support / Re: NGUI UICenterOnChild, How to know what is centered?
« on: October 07, 2014, 11:27:45 AM »
yeah I know, with IF statement it works, just for some reason SWITCH refuses to compare game objects and I can't just replace "case"'s with "if"s inside the switch so I just stuck with if/else if.

Anyway, I originally had my code in update using centeredObject but since it was not optimal I made it work with onCenter delegate function.

Thank you for your support.

7
NGUI 3 Support / Re: NGUI UICenterOnChild, How to know what is centered?
« on: October 06, 2014, 10:56:29 AM »
GetComponent<UICenterOnChild>().onCenter = YourCallback;

You really should just google "c# delegates".

I'll take another, deeper look at delegates but I asked here because I thought if I got the answer I'd understand the missing piece.
Doesn't onCenter trigger when the scripts starts centering on a new child object in the grid?
I also want to find out which specific child object it is.

EDIT:
Ok, I found the centeredObject but now NGUI changes the name of my objects to 0,1,2,3 and when you go in the other direction -1,-2,-3 etc. It would be ok if this was consistent, but the name changing happens at random, should it be like that?

On another note, when I try to compare centeredObject with my gameobjects it works if I use an IF statement but doesn't work when I use switch, like so:

Let's say I create an array of gameobjects to plug in these child objects so I can refer to them from the script. Then I'd like to write the Switch function like:
  1. public GameObject[] childArray = new GameObject[2];
  2. GameObject temp = UICenterOnChild.centeredObject;
  3.  
  4. switch(temp)
  5. {
  6. case childArray [0]:
  7. //do something
  8. break
  9. case childArray [1]:
  10. //do something
  11. break
  12. default:
  13. break;
  14. }
  15.  

Unity throws an error though saying "A switch expression of type 'Unity GameObject' cannot be converted to an integral type, bool, char, string, enum or nullable type"

I know this latter problem is not really NGUI related but does anyone happen to have an idea why switch statement can't process the gameObject?

Thanks

8
NGUI 3 Support / NGUI UICenterOnChild, How to know what is centered?
« on: October 06, 2014, 04:34:59 AM »
Hi guys,

I'm having trouble figuring out how to find out programmatically on which item does my NGUI grid center. I have a menu where items can be dragged horizontally and they get centered using UICenterOnChild. What I want is to find out from the script which item the menu is currently centered on.

I looked at the documentation of UICenterOnChild and there is a "delegate void UICenterOnChild.OnCenterCallback(GameObject centeredObject)". There's also a function "UICenterOnChild.onCenter" which triggers when a new object is being centered.

Probably the reason I don't quite understand the documentation is because I don't know how to use delegates yet. I thought I knew what they were and after looking at the unity's tutorial on delegates didn't find anything new but apparently I don't understand them enough to figure out how to achieve what I want in this case.

If anyone has any idea how to get that info I'll be happy to hear it.

Thanks in advance for you time.

Pages: [1]