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

Pages: [1] 2
Misc Archive / Sprite Selector not working in Unity 2017.1.3
« on: March 01, 2018, 12:49:46 AM »
I just noticed the sprite selector wasn't working in my project when clicking on "Sprite" in the UISpriteInspector (in 2017.1.3).  I looked back through source control and while I have made quite a few changes to Ngui 3.11.4 core, none had anything to do with this and this was working just a few weeks ago when I refactored the look of my chat window.  Then I changed to a fresh project with just Ngui installed and the same behaviour was exhibited there.

The window is clearly displaying - OnGui is being run ok for the sprite selector - but no window displays.  The Unity title bar does deactivate though - clearly it thinks the window is there, but it is just not being drawn.

Anyone know what the fix here is?  If it is upgrade to a newer version of unity or wait for unity to fix it, that would be fine.   But I am welcome to any known fixes too.

NGUI 3 Support / Application focus and hover events
« on: November 07, 2016, 09:44:17 PM »
When I unfocus my app I still get hover events (I can hear them) - e.g. if I have chrome up on top of Unity I can hear buttons being hovered while I am browsing.  My app is set to run in the background.  I trivially fixed it by keying off whether the application was focused in UICamera before applying a hover object.  Was there a reason this is not done in NGui already?  Something I am not thinking about?


NGUI 3 Support / 3d text burry
« on: July 17, 2016, 09:09:55 AM »
For a while now I have used 3d nameplates, and they work fine, and aesthetically look the way I want, but the text just looks bad.  I also support them as 2d nameplates - clearly they looked super crisp, but a lack of depth information and some other things make me dislike them a bit.

Is there any way to get the text crisper or is this just a limitation of rendering the text in 3d space?

I am having trouble getting the same color to match when tinted directly via the label color vs encoded as a color in a label.  I've had this problem for a few years now with one of my controls, and I have kind of ignored it.  Now I want to fix it.  I am aware of the color tint override/color encoding available when encoding colors in label text, and I have read all the forum posts on similar topics.

As a simple test case, I drop two labels in the scene, using NGui fonts, with no effect/gradients specified (basically a pure, basic label).  I color one using the tint, and the other with a white tint but encoded with the same color as the first label (using the color tint override shouldn't matter i assume in this case, but I tried both anway).

The colors do not match.  The color on the encoded text label is brighter.  Now, I could probably find an encoded color that matches the tint version and simply map them depending on the method of color I am using, or I could consolidate my logic to always use encoded colors, but honestly that is a bit of a nightmare.

I have tested this in a new project with just ngui imported, and using one of the ngui fonts, I can get the color to match sometimes.  Sometimes, they will not match, and then i will switch fonts around, or something, and then they will match (for the same font combination)!  It is almost like the font colors are not being updated immediately in some cases until something triggers it.

This is driving me a bit nuts :-).  I am using linear lighting / NGui 3.9.4.  I am about to upgrade to the newest just to make sure that doesn't fix anything.

NGUI 3 Support / Deselect input on disable?
« on: September 06, 2015, 09:28:36 PM »
On disable I am trying to disable an active UIInput with an override of Cleanup (called from OnDisable) on UIInput.  This, however, doesn't work (calling isSelected = false).

Is there a way to do this?  UIInput.selection remains set to the input even after it is disabled and when I re-enable the window the input is still happily focused.

NGUI 3 Support / Label color tint vs encoded color
« on: May 14, 2015, 11:26:14 PM »
I've noticed that the color tint for a label is accurate.  For example, grey, (128,128,128).  However, if I encode a label with [808080] the color is a noticeable lighter grey.  This is using TTF fonts.

I have a chat window, and when I add the chat in the chat text list, i encode it to the color of the channel it was sent on.  In addition, I color the input to the channel you are typing in.  They do not match, because the color of the encoded text in the text list is lighter (I tested this on a label at the root with a fully white color tint, with nothing obscuring it, just to make sure).

Why is this the case?


NGUI 3 Support / TTF fonts dissapear/garble when alt-tabbing
« on: April 20, 2015, 10:21:26 PM »

Any TTF fonts dissapear/garble when alt-tabbing.

This has happened ever since I moved to Unity 5.  Now, I have seen the disclaimer in Ngui basically saying "go bug Unity, it's not my problem" (always makes me lol a little) but does anyone have any idea if there is a workaround?  Since all of my UI is basically created up front and disabled for the most part, it means the minute you alt-tab you are basically done.

The TTF fonts look so much better than the bitmap ones.  I still use some bitmap fonts.  They appear to have no issues.

I tracked down the issue to the tooltip delay.  It would set the ClickNotification to None when the tooltip delay was 0.0001 (I was using essentially no delay).  Once I realized what the code was doing, changing the tooltip delay to 0.5 fixed the issue.

Can someone explain why the tooltip delay is now tied to anything around click processing?  Its not a huge deal, but I would still like to know why this is.

NGUI 3 Support / Linear lighting / multiple materials
« on: January 12, 2015, 10:48:25 AM »
NGui 3.7.7

I have been using the linear color space for a while, and have had no problems with the two atlases I currently use, using unlit/transparent colored.  However, I recently have been using some images from a different atlas from a third party, which use unlit / premultiplied colored.

The widgets that use this widget look washed out - obviously not being corrected for the color space.  I looked in the code and noted the color space corrections in UIBasicSprite and UILabel and scoured the forums.

I've tried:

1) Changing the unlit / premultiplied colored shader to:

half4 col = tex2D(_MainTex, IN.texcoord) * IN.color;
col.rgb = pow(col.rgb,2.2);
return col;         

This resolves the issue for the most part, but it doesn't resolve it on any nested panels (like scroll views, which I have a lot of).  I.e. in scroll views, the same button that displays fine on the screen that is not on the scroll panel looks washed out inside the scroll panel.

Since the code already seems to attempt to account for this, and since my current UI works fine in linear color space (and that shader has no alterations), I figure this is the wrong thing to do.

2) I also tried reverting my change to the shader and changing the import type of the button texture in question (to test) to advanced / bypass sRGB sampling and updating the atlas. This also did not resolve it.  All of the third party textures are set to Gui textures right now anyway - which I though via the documentation accounts for color space.

So I am a bit at a loss and what is going on here.

I have been tracking down something with UISliders.  I create almost all my UI dynamically, in inactive tables, that get activated and repositioned when needed.  When the starting value of my sliders are 0, what happens after the reposition is the tab is shown in the correct position, but the background is displayed way to the right of the tab.  If I manually reposition the table via the context menu after this, it fixes itself.  If I use set any value other than 0 as the starting value it works just fine - everything positions perfectly.  This implied to me that 0 was a special case.

The initial check in ForceUpdate does a check:

mFG.enabled = value > 0.001f;

which fails to active the FG in this case.  Commenting out this line and always forcing an enable has resolved this issue.  However, as i am sure there is a reason for this, I was wondering if there was a better way to resolve this would making ngui code changes.  I am using 3.7.7.

NGUI 3 Support / UIInput ignore typed space char and clear input value
« on: August 28, 2014, 11:25:15 AM »
I'm trying to implement a behavior where you hit the space bar and depending on the tokens of the UIInput value, I ignore the space and clear the input value.

I have overridden ProcessEvent and picked up the space, and clear out the input, but the space gets added after the value is cleared (with return true or false - not sure what this return value does - I was hoping one of them would ignore the character).  This is very close to the behavior I want, but it adds the extra space at the beginning of the input.

I have tried to do the same in a validation callback, but the validation callback is in the middle of a string builder building the new value, so clearing the value in the callback doesn't have any effect.

I have tried some combinations of the two, but I wasn't able to get it to work.  I am assuming this is probably the approach I will need.

Any ideas?


NGUI 3 Support / UITable / UIPanel Requests
« on: January 24, 2014, 12:20:56 PM »
Three questions (added another):

1) For UITable, it doesn't reposition right away on the first update until it grabs a reference to the panel.  If you don't use keep within panel there doesn't appear to be a reason to wait until the update.  Can you allow Reposition () to fire immediately when KeepWithinPanel is false and initdone is false?

  1.                 if (Application.isPlaying && !mInitDone && NGUITools.GetActive(this) && keepWithinPanel)
  2.                 {

When I put this in, it resolves a lot of problems that require me to wait a frame.  You could also put in a little optimization to not bother grabbing the panel if KeepWithinPanel is false.  I know I could subscribe to the OnReposition event, but this works better IMHO.

2) Can we get an event for panel dimensions changing?  I dynamically change clipping areas of panels in scroll views and I need to propagate those changes to subscribers so they can adjust their dimensions in some cases.  There is a panel OnChange, but it handles a different use case than UIWidget OnChange (which handles dimensions).  Why not add a OnDimensionChanged event to the UIRect that both UIWidget and UIPanel inherit?

3) Any way you could make the isEnabled in UIButton virtual?  I inherit from this class and override this behavior since UIButton expects a collider and disables itself without one.  Instead, I am using it without a collider and pushing events to it manually from underlying colliders (I use this for RowHover highlights on my multi-column list control).  This one is debatable, but I don't see any harm in it.
3.09 f4

NGUI 3 Support / UIScrollView bug?
« on: January 17, 2014, 02:23:56 PM »
Note: 3.0.8 F6 (posting because I don't see the fix in the F7 release notes).

Shouldn't the line below:

         if (movement == Movement.Horizontal || movement == Movement.Unrestricted)


         if (movement == Movement.Horizontal)

as otherwise if you have movement == Unrestricted and custommovement = {0,1} it will scroll horizontally instead of vertically (because the code then is "new Vector3(mScroll * 0.05f, 0f, 0f));" which scrolls in X even if custom movement is along the Y.

This certainly fixed the problem I was having.

  1.                 // Apply momentum
  2.                 if (mShouldMove && !mPressed)
  3.                 {
  4.                         if (movement == Movement.Horizontal || movement == Movement.Unrestricted)
  5.                         {
  6.                                 mMomentum -= mTrans.TransformDirection(new Vector3(mScroll * 0.05f, 0f, 0f));
  7.                         }
  8.                         else if (movement == Movement.Vertical)
  9.                         {
  10.                                 mMomentum -= mTrans.TransformDirection(new Vector3(0f, mScroll * 0.05f, 0f));
  11.                         }
  12.                         else
  13.                         {
  14.                                 mMomentum -= mTrans.TransformDirection(new Vector3(
  15.                                         mScroll * customMovement.x * 0.05f,
  16.                                         mScroll * customMovement.y * 0.05f, 0f));
  17.                         }

NGUI 3 Support / Handling depth for user controls
« on: January 04, 2014, 02:06:04 PM »
Currently I make heavy use of user controls ala the composite pattern, as I am sure many others do.  I'm trying to understand the best method for handling depth management for user controls nested in other panels.  Previously in 2.x I had to add panels to these controls in many cases in order to deal with interleaved atlases (to force another batch).  In 3.x this is gone now, which is fantastic.  In 3.x you can now set the depth property of a panel, which is great, but it still forces another batch (I believe) which is bad in many cases.

For example, if you had a button user control (prefab, etc.), you would want to set the depth for its child controls relative to its root, and then when dropping the user control onto another panel, only need to adjust the "root" depth for the entire control.  Using a panel on the button root itself would solve the depth management issue, but force (I think) another batch which would be unnecessary.

I could code a simple, quick solution, certainly, but this is a pretty common use case so I am wondering if I am missing something.  Is this something that is currently supported?

Unity: 4.2.1f4
Win 7/64 bit
NGui Standard

I upgraded my 2.2.6c project to 2.7 without any issues.  Everything was working pretty much the same after the upgrade with the exception of a few depth sorting issues which I deferred until I had upgraded to 3.x.

Upgraded to 3.08f3 with the instructions - creating a new scene, deleting ngui, importing ngui, fixed the compile errors, and then ran the upgrade package to install the editor scripts.

After this I tried to bring up my core menu scene which contains most of the menus in a deactivated state, and Unity crashes.  Unfortunately I don't have the log anymore as I was able to get the scene to come up successfully later (more on this below).

I know the call died in UIAtlas:Upgrade on the line: UnityEditor.AssetDatabase.SaveAssets();

I started binary searching and have found that if I delete all the atlases (your four example ones plus the two custom ones I had made), the scene comes up properly after that, albeit with broken references to the removed atlases of course.

I would very much like to not have to rebuild and re-reference these atlases - so I guess my next step will be to repeat until I know which atlas(s) is potentially causing the problem and then only delete that atlas to minimize rebuilding.

I'm guessing there is just no enough repro info here to really have any idea what is going on.  Just a shot in the dark..

Pages: [1] 2