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

Pages: [1]
NGUI 3 Support / Re: Visibility Bug with Widgets When Enabling/Disabling?
« on: January 31, 2014, 03:15:35 PM »
As a final note, our studio updated from a 2.X release to the latest 3.0.9f4, and we've definitely gotten many instances where UI elements don't appear when they used to, or elements inexplicably don't appear until they are interacted with, or other odd visibility issues.

I have no idea why this is the case, but it is either some bug in the system, or we are using the UI elements incorrectly (which had worked with previous NGUI versions).

NGUI 3 Support / Re: Visibility Bug with Widgets When Enabling/Disabling?
« on: January 31, 2014, 01:28:52 PM »
Hey ArenMook, I'm using 3.0.9 f4.  To follow up, of course commenting out a random line in OnEnable causes issues elsewhere (particularly during editing, but still not great) ;).

So yeah - I switched to using the alpha instead and that seems to work fine.  I'm not sure if there's an issue with enabling/disabling or not, but basically I think this particular sprite also has an animation on it that adjusts its scale, so I think it is possible for the scale of the sprite to be 0,0,0 when it is first enabled, which might be causing issues with some calculations or something.

Anyway, just speculating there - I think my issue is resolved.  Thanks!

NGUI 3 Support / Visibility Bug with Widgets When Enabling/Disabling?
« on: January 30, 2014, 10:26:35 PM »
I have a sprite that appears and disappear in my UI from time to time.  To do this, I'm simply modifying the sprite's "enabled" property:

  1. player2Piece.enabled = enabled;

However, when I enable the piece, it would occasionally not appear, though the game object and sprite component were both active/enabled.  I noticed that if I modify the sprites color, or if I suspend/resume the game, the sprite reappears.

So, digging into the UISprite/UIWidget/UIRect code, I found that only the UIRect is doing anything in OnEnable.  For some reason, if I comment out the OnInit line, my sprites appear consistently every time and behave as expected:

  1. // In UIRect code.
  2. protected void OnEnable()
  3. {
  4.     mAnchorsCached = false;
  5.     //if (mStarted) OnInit();
  6. }

So, that seems to fix my issue...but I don't understand what that line does or why commenting it out causes the sprite to show as expected.  When toggling Sprite visibility, is it incorrect to use the "enabled" property of the component?  Is there a "right" way to do this that I'm not seeing?

NGUI 3 Support / Re: Scroll View Contents Not Drawn Correctly
« on: January 23, 2014, 02:38:19 PM »
Hmm, I just updated to 3.0.9f4 and I'm seeing the same issue, though it seems less consistent.

I'm finding that adjusting the panel's clipping size will (so far) always resolve the issue.  More specifically, it seems that setting mResized to true causes some sort of recalculation that fixes the issue.

EDIT: Actually I think the cause of this was that when I switched over to the "UI" camera event type, I made the following change:
  • DraggablePanel
    • Button1 (collider w/ UIWidget)
    • Button2 (collider w/ UIWidget)
  • DragPanelContents

My buttons have a collider on their top level that is used for input - problem was, with "UI" type camera, all the input was being eaten up by the DragPanelContents, so I added UIWidget components to my buttons to give them higher UI input priority.

I think the dimensions of the UIWidget components was causing something weird to occur...I swapped so that the DragPanelContents has a low-priority UIWidget on it, and took the UIWidget components off of the buttons.  This seems to work much better, but I'll let you know if I run into the issue again.

NGUI 3 Support / Scroll View Contents Not Drawn Correctly
« on: January 21, 2014, 10:18:52 PM »
This is similar to, and maybe the same issue, as outlined here:  I'm using 3.0.8 f3; I can update to the latest if you think it will help, but I didn't see anything about this in the change logs.

Basically, when I animate the position of a panel (adjusting it's localPosition) that has a scroll view in it (to move a panel off-screen, for example), the contents of the scroll view will occasionally disappear.  If I view the panel in editor after this occurs, I can see that the contents of the panel appear to be missing.  The "Draw Call Tool" shows that the panel has "No draw calls found".

I'm finding that three things can potentially fix the issue:
  • If you move the contents of the scroll view by dragging it, the contents reappear.
  • If I disable the panel before animating it, and then enable the panel, it appears that the contents refresh and show.
  • If I adjust the panel's clipping center/size data, the panel contents reappear.

In the case of #3, I find that in script, all that really matters is that mResize be set to true; this seems to recalculate the clipping area and show the panel contents properly.  From what I can gather, it seems that maybe moving the scroll view is causing the clipping region to get messed up somehow, which is fixed by forcing a resize event on the panel.

It seems to be a bug to me, but please let me know if I'm doing something wrong as well!

NGUI 3 Documentation / Re: UICamera
« on: January 21, 2014, 02:44:15 PM »
When using the "UI" mode, how do you handle the depths of colliders that are not attached to widgets?  For example, I have some colliders that are not attached to any sort of widget, but that handle UI events - there seems to be no way to set the depth value so that they are correctly sorted.

I see that I can add a UIWidget component and that seems to fix the problem.  Is that the recommended way to resolve this sort of problem?

NGUI 3 Support / Re: Two Bugs/Issues in NGUI 3.0.8f7
« on: January 15, 2014, 04:49:53 PM »
To follow up on that first issue, it seems that I had some UITextures in my panel that were using the "Unlit/Transparent" shader that comes with Unity.  When I switched this to the "Unlit/Transparent Colored" shader that comes with NGUI, everything seems to be working...maybe at runtime, the Unity shader can't be loaded correctly for some reason?

NGUI 3 Support / Two Bugs/Issues in NGUI 3.0.8f7
« on: January 15, 2014, 04:39:15 PM »
Not sure if this is the place for bug reports, but I didn't see any other place, so here it is!

First off, I got this a couple times in the editor while switching between panels.  Not sure if it is a problem with the way I'm doing something, but it had worked previously with NGUI 2.x:
  1. NullReferenceException
  2. UnityEngine.Material..ctor (UnityEngine.Shader shader)
  3. UIDrawCall.CreateMaterial () (at Assets/Foundation/NGUI/Scripts/Internal/UIDrawCall.cs:310)
  4. UIDrawCall.RebuildMaterial () (at Assets/Foundation/NGUI/Scripts/Internal/UIDrawCall.cs:325)
  5. UIDrawCall.UpdateMaterials () (at Assets/Foundation/NGUI/Scripts/Internal/UIDrawCall.cs:347)
  6. UIDrawCall.Set (.BetterList`1 verts, .BetterList`1 norms, .BetterList`1 tans, .BetterList`1 uvs, .BetterList`1 cols) (at Assets/Foundation/NGUI/Scripts/Internal/UIDrawCall.cs:470)
  7. UIPanel.SubmitDrawCall (.UIDrawCall dc) (at Assets/Foundation/NGUI/Scripts/UI/UIPanel.cs:1042)
  8. UIPanel.FillAllDrawCalls () (at Assets/Foundation/NGUI/Scripts/UI/UIPanel.cs:999)
  9. UIPanel.UpdateSelf () (at Assets/Foundation/NGUI/Scripts/UI/UIPanel.cs:939)
  10. UIPanel.LateUpdate () (at Assets/Foundation/NGUI/Scripts/UI/UIPanel.cs:893)

Second, I started getting an issue from time to time on Android, though not sure if it's platform-specific.  It wasn't happening in the editor though.  When a panel is not on screen, I disable it or enable it using this code:

  1. public static void SetPanelsEnabled(GameObject parent, bool enabled)
  2.         {
  3.                 if(parent == null) { return; }
  5.                 // Enable/disable panel elements.
  6.                 UIPanel[] panels = parent.GetComponentsInChildren<UIPanel>(true);
  7.                 for(int i = 0; i < panels.Length; ++i)
  8.                 {
  9.                         panels[i].enabled = enabled;
  10.                 }
  11.         }

However, I get this error on device if I use that code:
  1. I/Unity   (28837): NullReferenceException: Object reference not set to an instance of an object
  2. I/Unity   (28837):   at UIPanel.FindDrawCall (.UIWidget w) [0x00098] in /Projects/TicTactics/Assets/Foundation/NGUI/Scripts/UI/UIPanel.cs:1301
  3. I/Unity   (28837):   at UIPanel.UpdateWidgets () [0x0010b] in /Projects/TicTactics/Assets/Foundation/NGUI/Scripts/UI/UIPanel.cs:1269
  4. I/Unity   (28837):   at UIPanel.UpdateSelf () [0x00017] in /Projects/TicTactics/Assets/Foundation/NGUI/Scripts/UI/UIPanel.cs:934
  5. I/Unity   (28837):   at UIPanel.LateUpdate () [0x00020] in /Projects/TicTactics/Assets/Foundation/NGUI/Scripts/UI/UIPanel.cs:893

When I removed the calls to enable/disable the panels when showing/hiding the screens, this error no longer showed up.

Not sure if that's helpful, but hopefully it can give you some clues.

NGUI 3 Support / Input on Clipped Content
« on: January 13, 2014, 02:08:25 PM »
Perhaps this is by design in the NGUI 3.0, but I wanted to check.  I noticed that when we have a scrolling panel that is clipped, I can still click buttons on the scrolling panel that are outside the clipping area.  This has lead to some confusion and bug reports, since testers tap on an empty area underneath a clipped panel, but it still reacts as though you've just clicked a button that is outside the clipping area.

It's possible to add additional colliders to block input outside of the clipped panel, but that seems like a hack that wasn't required with previous versions of NGUI.  I also noticed that this seems to only happen when the UICamera Event Type is set to "World".  Setting it to "UI" seems to behave correctly, but I haven't tested it thoroughly.

So, should input function this way, or is this a bug?

NGUI 3 Support / Re: Dynamic Text Flickering Issue
« on: January 13, 2014, 01:55:54 PM »
Thanks for the link; I'll try requesting the characters up-front and see how it goes!

NGUI 3 Support / Dynamic Text Flickering Issue
« on: January 10, 2014, 10:32:56 PM »
Since we started using dynamic fonts, we've had an issue where text labels will occasionally flicker, shear, and artifact momentarily when new text is displayed on the screen.  This was using Unity 4.2 and NGUI 2.3.  While searching for a fix for the issue, I happened upon this thread:  In no uncertain terms, the suggestion was: upgrade to NGUI 3.0, and the problem will go away.

However, I've recently updated to Unity 4.3.2 and NGUI 3.0.8 f7.  Much to my dismay, while running our game on both iOS and Android, the issue is still occurring.  Is anyone else still having this issue?  Are there any settings, tips or leads I can follow up on to fix this issue?  Maybe there is a correct way to set up dynamic fonts that we're missing?  Our game is looking great, but this issue rears it's ugly head a couple times per game session.  Any action I can take to resolve the issue would be much appreciated.

NGUI 3 Support / Dynamic Font Size Considerations
« on: January 08, 2014, 01:44:44 PM »
I'm finding that the font size changes in the latest NGUI have a lot of potential for flexibility - it's pretty cool to have a dynamic font and be able to size it to fit each specific circumstance. 

However, I had a concern about the font atlas generated by NGUI/Unity.  Let's say I have five labels that are all using a font size of 24.  I'm guessing this will cause the font atlas to have all the required letters in size 24.  But what if each of the five labels has a different font size?  Will this mean that many letters will get duplicated on the font atlas because of the size differences?  Would this cause memory issues in some circumstances?

I'm developing mainly for iOS and Android, so I'm worried there may be performance or memory concerns with this.  Previously, we had defined two font sizes, 40 and 80, and we only used these with scale adjustments.  Is that a better approach, or is it OK to have many different font sizes throughout the game - 16, 22, 24, 30, 31, 40, etc?

NGUI 3 Support / UITexture Auto-Add Pixel Behavior
« on: January 08, 2014, 12:33:39 AM »
I happened upon that feature of UITextures where it will automatically add an additional pixel to non-even textures.  I gather this is useful for centering odd-pixel widgets, but it was a bit surprising to encounter in other contexts. 

For example, I have a need to display a 9x9 pixel UITexture that essentially fits into a picture frame UI very snugly.  It was surprising after upgrading to NGUI 3.x that it didn't fit correctly and had an unexpected extra gap around the edges - had to do some digging to discover why it was occurring, but it seemed like a bug at first.

For now, I've got to comment out those lines in UITexture, but my feedback would be having some sort of way to toggle whether you want to use that "extra pixel" functionality in the future or not.

NGUI 3 Support / NGUI 3.0.8 - Uniform Scaling and Scale-from-Center
« on: January 07, 2014, 10:06:23 PM »
I've just started upgrading my project from NGUI 2.x to the latest version of NGUI.  All is compiling and the game is looking pretty decent, except for most of my text and graphics are not the right sizes anymore (I think as a result of not using the transform scale anymore, and widget scale being reset to 1).

I'm trying to resize my various widgets and texts, but I'm running into some possibly "dumb" issues:
  • A great feature of the Transform scale tool is that it allows uniform scale along all axis.  Is there a way to adjust the dimensions of a widget uniformly? I'm finding editing the two dimension values separately to be a huge pain, especially when the widget is not a square image.
  • Similarly, I really like being able to scale from the center point of an object.  I noticed that when I scale using the handles, it will change the widget's position as well, which is making resizing more complicated than it needs to be.  Is there a way to scale a widget from it's center point using handles or some other NGUI tool?

I'm concerned that it isn't possible to do these things with the latest NGUI changes, but I'm also wondering if I'm just missing shortcut keys or some unobvious feature.

Pages: [1]