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

Pages: [1]
1
I found a bug in UIPopupList that occurs when the hierarchy looks something like this:

UIRoot
  PanelParent (empty GameObject)
    UIPanel
      UIPopupList

There is a bit of code in UIPopupList.Show() that causes the position of the popup's generated "Drop-down" object to be based on the panel's parent even though the "Drop-down" object is still a child of the panel.  This causes a problem if the panel's local position is not (0,0,0).

This issue can be reproduced in Example 0 by rearranging your hierarchy as described.  I used a game window that was sized around 1920x1080, with the panel's parent anchored to the top-left corner of the screen.  The panel's clipping option was set to None.  With this setup, the popup works fine if the panel and popup are in the top-left quadrant of the screen.  If you move the panel (along with the popup) over to the bottom-right quadrant of the screen, you will see that the popup's "Drop-down" object will be constrained to the top-left quadrant of the screen.

Commenting out this code near the end of UIPopupList.Show() fixed this issue for me:

  1.                         Transform pt = mPanel.cachedTransform.parent;
  2.  
  3.                         if (pt != null)
  4.                         {
  5.                                 min = mPanel.cachedTransform.TransformPoint(min);
  6.                                 max = mPanel.cachedTransform.TransformPoint(max);
  7.                                 min = pt.InverseTransformPoint(min);
  8.                                 max = pt.InverseTransformPoint(max);
  9.                         }
  10.  

2
NGUI 3 Support / Bug: OnKey not called while useMouse == false
« on: June 20, 2016, 11:08:14 AM »
This bug was causing problems in UIInput while useMouse == false.  Here is the fix:

In UICamera:

  1. if (!useMouse && (key >= KeyCode.Mouse0 || key <= KeyCode.Mouse6)) continue;

should change to:

  1. if (!useMouse && (key >= KeyCode.Mouse0 && key <= KeyCode.Mouse6)) continue;

3
Hello,

When pressing a cancel key (set in UICamera), the currently selected UIInput is not deselected.  I set a breakpoint in UIInput.OnKey, but the breakpoint was never hit when pressing the cancel key.  This behavior can be reproduced in the Chat Window example scene (Example 12) in NGUI 3.9.8.

Please let me know what I should do fix this issue.

Thanks

4
When there happens to be a hitch or otherwise low framerate while the user is typing input, the order of their submit command relative to the rest of their input can change.  For example, if the user types "Hello World" and then presses Enter while experiencing poor performance, their input might be received instead as "Hello W", Enter, "orld".  Looks like this is due to the separate implementation of the submit key in the OnGUI method (via the UIInputOnGUI class).  This is probably true for other non-text input (such as backspace, arrow keys, copy, paste, etc.) that are processed by UIInputOnGUI.

Ideally, everything would happen in the order that the keys were actually pressed regardless of any performance issues.  The fact that it does not even further punishes users on lower-end machines that regularly experience poor performance.

Any ideas about how to remedy this problem?

5
I came across this issue when I selected an input field on a panel with alpha = 0 and then tweened the panel's alpha to 1.  The cursor was invisible until the next call to UIInput.UpdateLabel(), which is not called until the user either starts typing or manually reselects the input field.  This is confusing to the user because they are not aware that the input field is selected.

6
I have come across an issue that seems to be a bug with UIRect and NGUITools.AddChild.

After using NGUITools.AddChild(parent, prefab) to instantiate a UIRect as a child of a panel, the UIRect does not find the parent panel (or possibly finds a different panel above the parent in the hierarchy), with the end result being that the instantiated UIRect is not drawn by the correct panel.  This breaks TweenAlpha functionality, since the UIRect cannot be tweened by tweening the alpha of its proper parent panel.

It looks like the problem is that the UIRect looks for its parent in its OnEnable method, which is called immediately when the prefab is instantiated, before its transform.parent is set in NGUITools.AddChild.  The UIRect.mParentFound is then set to true, preventing the UIRect from finding its proper panel after its transform.parent is set in NGUITools.AddChild.  Adding the following lines to the end of NGUITools.AddChild fixes the problem (but is very dirty :P):

  1. //go is the instantiated prefab
  2. foreach(UIRect rect in go.GetComponentsInChildren<UIRect>())
  3. {
  4.     rect.enabled = false;
  5.     rect.enabled = true;
  6. }
  7.  

This works because UIRect.mParentFound is reset in UIRect.OnEnable() and UIRect.OnDisable().

I look forward to a fix in the near future.  ;D

Pages: [1]