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

Pages: [1]
NGUI 3 Support / "Nested" toggles cause a problem when hiding children
« on: October 21, 2013, 08:25:29 AM »
In our UI we have a set of UIToggles, let's say 2 of them, which show or hide sub-options. They are in their own group. So enabling one will disable the other.

Enabling a certain toggle will show a kind of sub-ui. This part of the UI also has UIToggles (in their own group). The "nesting" I speak of here is not a physical parent-child relationship of these toggles. Just that some parts are controlled (hidden/shown) by the "parent" UIToggles.

The issue I'm running into is with UIToggle's Set(bool state). When I click on a parent check-box, it will set that one as checked. And it will set the other one to be unchecked. Doing so will trigger a routine to hide the children UIToggles.

This leads to a nullpointer exception in the following section within UIToggle (Line 177 onward):

  1. for (int i = 0, imax = list.size; i < imax; ++i)
  2. {
  3.         UIToggle cb = list[i];
  4.         if (cb != this && == group) cb.Set(false);
  5. }

The case is that imax is initialized to a value where all UIToggles were still visible. Parents and the active parent's children toggles included. However, the updates cause the list to be modified (somehow, I'm unclear on the call order) leaving it with less items (after all, some of them were made invisible). So list.size is lower inside the loop than the value imax was initialized to. And this will cause a problem with cb being null at some point.

I fear the answer is going to point at me, but could this be a problem/unforeseen circumstance on the NGUI side of the equation. Or am I simply trying to do something I really shouldn't do?

If necessary I could try and extract a simple stand-alone example, should the description not be clear.

I have a pretty simple setup of 3 UICheckboxes. The first checkbox determines the visibility of the other two, by setting their parent GameObject (which is their Radio Button Root) active or not. (Note that the first checkbox is completely independent. It does not have a radio button root).

When unchecking the first checkbox, I want to uncheck the other two and hide them. This all seems to work just fine, until I check the first checkbox again. This sets the parent GameObject active again, and for (what I assume to be) a single frame, the checkSprite of the previously selected UICheckbox is visible.

So I assume I'm not properly updating something, not calling a refresh I should call, or something to that effect. Would there be something obvious in this situation that I should take care of? Functionally all is fine. It's just this flicker that is somewhat annoying.

NGUI 3 Support / Detect that an atlas has been updated
« on: August 26, 2013, 05:32:04 AM »
As part of some asset management tools, I want to detect whether or not an atlas has changed. This will allow me to invalidate selected sprites that no longer exist, so I can signal this to the user, for example.

Using the AssetPostprocessor, I can detect changes to an atlas prefab just fine when adding a texture to the atlas. However, when removing a texture, there is no clear update event. (There are events for the png itself, but it would be nice if I could hook into the prefab updates somehow).

Is there a way to easily detect both events? Is something else signalled that I can hook into?


It seems that when reverting back to 2.6.2 instead of 2.6.4 I do get the proper prefab events signalled in OnPostprocessAllAssets. A coincidental discovery, because we reversed back to 2.6.2 after several unexplained issues with 2.6.4. (Such as checkboxes not responding properly, or not drawing their checkmarks on occasion). I'll investigate that as well and will create a post if I can reliably reproduce it.

NGUI 3 Support / UIPanel animation/tweening is jittery
« on: August 22, 2013, 09:24:07 AM »
I have a UIPanel with an alpha clip. Below it I have a UIGrid with UIImageButtons. Two other buttons are there to select the next item within the grid, to be shown in the center of the clipped area. (All sprites come from the same atlas) So far so good. The animation works and all seems peachy.

However, when animating the panel (by modifying its transform and updating the clippingRange), the animation seems somewhat jittery from time to time. Not back and forth, but as if the update between frames is not as it should be. The profiler doesn't provide any information on what might be the cause. There are no clear performance hogs that influence the smoothness of the framerate or such.

For the animation itself I've used several approaches. I used a TweenPosition, I've written my own basic tweening, and I even tried animating the grid instead (bad, I know, but hey).

Would anyone have any idea where I should look for possible bottlenecks? Has anyone experienced similar issues?

I don't know if this has already been reported (I couldn't find it) but the Widget Wizard for a UIImageButton has a minor issue after the inclusion of a disabled sprite.

The disabled sprite is not actually set for the UIImageButton. The culprit is a single missing line in CreateImageButton in UICreateWidgetWizard.cs

  1. ib.disabledSprite = mImage3;

Adding that should do the trick.

Pages: [1]