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

Pages: [1]
1
NGUI 3 Support / new depth sorting feature
« on: September 16, 2013, 01:08:13 PM »
I tried out the new depth sorting feature to understand how it was different. I was hoping that it would make it so UIPanel would automatically detect when a new draw call was necessary, and make the draw calls as needed, even if it meant drawing from the same atlas multiple times due to a different atlas being used in between the sort order.

Sometimes you need to have text in front of and behind sprites from the same atlas, and the font is on a different atlas. That requires three draw calls total. It appears that I still need to add another UIPanel for the foreground stuff and set the z coord a little closer to be in front of the other stuff.

2
NGUI 3 Support / UILabel Shrink to Fit width no longer works
« on: September 16, 2013, 10:04:21 AM »
We just updated our NGUI, and I noticed that UILabel now has an option to shrink to fit height. However, the shrink to fit width no longer works. All it does it cut off the text instead of shrinking it. Now only reducing the "Max Height" actually shrinks the text.

Also, I would really like it if the shrinking ignored the new height option if Max Height is set to 0, mainly for backwards compatibility.

3
NGUI 3 Support / extra UIPanel being created
« on: August 18, 2013, 12:27:20 PM »
I've been running into a situation where when I drag a prefab of NGUI stuff into my NGUI hierarchy in the scene, it always ends up with a UIPanel on it when it shouldn't. I dug into it and found that there must be a Unity bug that temporarily puts the new scene object at the root, which is when the OnEnable of UIImageButton is fired off, THEN gets moved to the final place in the hierarchy. NGUI always thinks there is no UIPanel rendering this new thing since it checks while the object is at the root of the project. I have reported this bug to Unity, but in the meantime I have also made these changes to UIImageButton, which seems to help as well.

Basically, in the OnEnable() function, I pass false to the UpdateImage() function, telling it not to do a MakePixelPerfect(), since that is what triggers creating the UIPanel. I don't think it's necessary to call MakePixelPerfect() during OnEnable() anyway.

  1.         void OnEnable () { UpdateImage(false); }        // Gillissie added false argument.
  2.        
  3.         void UpdateImage(bool makePixelPerfect = true)  // Gillissie added makePixelPerfect argument.
  4.         {
  5.                 if (target != null)
  6.                 {
  7.                         if (isEnabled)
  8.                         {
  9.                                 target.spriteName = UICamera.IsHighlighted(gameObject) ? hoverSprite : normalSprite;
  10.                         }
  11.                         else
  12.                         {
  13.                                 target.spriteName = disabledSprite;
  14.                         }
  15.                         if (makePixelPerfect)
  16.                         {
  17.                                 // Gillissie - Added this condition, since calling this when dragging a prefab
  18.                                 // into the scene in the editor causes a UIPanel to be added unnecessarily,
  19.                                 // due to a bug in Unity where the OnEnable() function is called on objects
  20.                                 // before they reach their final place in the hierarchy, so NGUI doesn't find
  21.                                 // the UIPanel when first being activated.
  22.                                 target.MakePixelPerfect();
  23.                         }
  24.                 }
  25.         }
  26.  

4
NGUI 3 Support / swiping/dragging detection on particular objects
« on: August 14, 2013, 05:15:08 PM »
I have multiple areas in my mobile UI that will require a swipe to go to the next page of stuff. For this reason, I need to be able to know which area was touched when the swipe happened, so only that area changes pages. I am having a hard time understanding how to detect this information with NGUI.

For each swipable area, I have created a box collider.

I've tried looking at UICamera.currentTouch, but I can't figure out how or when that is populated with data I need. I don't know if NGUI has any kind of built-in support for drag events on particular objects, without the actual dragging of the object (the collider shouldn't move - it only needs to detect the touch, and the distance moved while touching).

On other non-NGUI projects that I've done this kind of thing, it was easy to store which object was touched, and the mouse location of the original touch, and compare it to the current mouse location to get the drag distance, and have certain things react only if certain objects were initially touched.

Thanks!

5
NGUI 3 Support / Bug with UILabel "adjust scale to fit"
« on: August 12, 2013, 07:27:38 AM »
I am setting up my game so that there are two different sizes of each font, and using a reference font that gets set to one of the sizes, depending on what resolution the game is being run in (on a mobile device).

This works great, except that the "adjust scale to fit" feature seems to ignore the pixel size value of the current font. It seems to scale the label based on a pixel size of 1, no matter what it is set to.

6
NGUI 3 Support / panel clipping documentation
« on: July 27, 2013, 01:37:19 PM »
Is there documentation on how the clipping options work? The class description for UIPanel barely says anything about the clipping option. http://www.tasharen.com/ngui/docs/class_u_i_panel.html

In particular, I'm curious what the "Alpha" option is for and how it is different than the hard and soft options?

7
NGUI 3 Support / font sprite issue
« on: July 27, 2013, 09:35:08 AM »
I'm having a weird issue with a couple of fonts, but not all of my fonts. The sprite size of the font looks correct when I view it on the atlas, but when I view the font itself, the preview shows it the wrong size, and it doesn't draw correctly due to that. See screenshots. The atlas view looks correct for the "Small" sprite. The font view is the incorrect size (doesn't match the font size it's mapped to).

8
NGUI 3 Support / suggestion: inverted SlicedSprite
« on: December 03, 2012, 03:45:38 PM »
I would love it if I could slice a sprite and scale it so the center stays actual size and the edges stretch, which is the opposite of what Sliced Sprite does right now. What I need to do is have a sprite with a huge amount of edge color around it (repeating the edge pixel), but I don't want to (or can't) make an atlas large enough for that kind of sprite.

9
NGUI 3 Support / bug report in UICamera.cs
« on: August 23, 2012, 12:00:35 PM »
This code in UICamera.cs needs to have the nullcheck on currentTouch.pressed to avoid null reference errors if the clicked object was deleted upon the first click:

  1. if (currentTouch.clickTime + 0.25f > time && currentTouch.pressed != null)
  2. {
  3.         currentTouch.pressed.SendMessage("OnDoubleClick", SendMessageOptions.DontRequireReceiver);
  4. }
  5.  

10
NGUI 3 Support / Mouse interaction issues
« on: July 24, 2012, 12:59:41 PM »
I have two issues with the mouse...

1. When mouse down over an object, then dragged outside of it, then releasing, no click is registered (as expected). However, if you then click outside the object and drag back onto it and release, a click is registered (not expected). This only seems to happen if you do the click on/drag out first. It seems like something is getting reset with the mouse status when you release the button outside of the object.

2. Is there a way to cancel mouse clicks in NGUI? Our game relies on click & hold & drag mouse to scroll the view. When the mouse has moved more than a certain threshold (20 pixels) then the scrolling kicks in and we need to cancel the button interaction. We have this system working perfectly for our game, but we need to cancel NGUI button clicks when switching to scroll mode so the UI buttons don't get clicked while scrolling.

11
NGUI 3 Support / bug with UILabel effects
« on: June 26, 2012, 12:25:14 AM »
Hello,

I noticed something that appears to be a bug. I have a UILabel with the Shadow effect defined. It looks correct in the editor at design time. When I instantiate the prefab that has the label, I immediately set the localScale to Vector3.zero to hide the label until after some other stuff happens, then I call MakePixelPerfect() to show the label. However, when I do this, the shadow effect is not visible. The properties on the UILabel show it set to Shadow and the color set as expected, but the effect isn't there. If I change the color or the effect style, it seems to fix it. As a workaround I am changing the style in code to None then back to Shadow after calling MakePixelPerfect().

12
NGUI 3 Support / UIInput suggestion
« on: June 21, 2012, 04:08:49 PM »
Please add a property to UIInput that allows us to specify which characters are allowed for input, then have UILabel ignore any input that isn't in that property.

For example:
myInput.allowedCharacters = "0123456789\n\r";

13
NGUI 3 Support / acceptable parent position values?
« on: June 08, 2012, 10:48:08 AM »
I have several situations where I have multiple NGUI objects as children of an empty GameObject so I can move all of them together. I assumed that as long as I kept the position values of the parent to whole numbers, then MakePixelPerfect() on the children would display correctly. However, I'm seeing all kinds of non-pixel-perfect issues. Is there a key to parent positioning to make the children's MakePixelPerfect() actually display right?

14
NGUI 3 Support / UIButtonTween OnHoverFalse not working?
« on: May 25, 2012, 01:55:27 AM »
I'm trying to get another object to scale up to 1,1,1 when a button is moused over, and scale back down to 0,0,0 when moused out, but the mouse out doesn't do anything. Please see the attached screenshots of the button and the object that is the tween target. What am I doing wrong?

15
NGUI 3 Support / stopping animation with button event
« on: May 25, 2012, 01:15:19 AM »
I use UIButtonPlayAnimation to start a looping animation when a button is moused over. I would like that animation to stop playing when the button is moused out. I don't see a way to do that without creating a function to do it and sending a message on mouse out. Can we get a UIButtonStopAnimation script, or maybe there is already an easy solution I haven't found?

Thanks.

Pages: [1]