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

Pages: [1] 2
NGUI 3 Support / Re: Adding and Removing elements from Scrollview
« on: August 25, 2014, 05:46:35 PM »
I finally got around to updating NGUI and then back on task with work related to this bug. It is unfortunately, still happening.

Currently running NGUI 3.6.7.

I would like to set the size of a UISprite to be the size of a grid with its children. It looks like UIStretch can do that, but it's deprecated in place of the anchoring system. One can't anchor a UIWidget to a grid because a grid is not itself a widget. How should I go about populating a grid and then resizing a texture to be the size of the elements in the grid?

NGUI 3 Support / Re: Right To Left UIGrid?
« on: June 23, 2014, 01:28:47 PM »
Scale it by -1 in X?

NGUI 3 Support / Re: Hide object in UIGrid
« on: June 19, 2014, 12:09:35 PM »

  1. NGUITools.Destroy(card.gameObject);

The problem is that GameObject.Destroy() doesn't happen until the following frame. So you need to remove it from the transform this frame so that the grid will reposition properly. Unity documentation says you should *NOT* use DestroyImmediate except for editor code. (

NGUI 3 Support / Re: Adding and Removing elements from Scrollview
« on: June 16, 2014, 11:41:46 AM »
- NOTE: NGUI now requires Unity 4.3.4 or higher!

Is that not true?

NGUI 3 Support / Re: will Ngui become obsolete?
« on: June 13, 2014, 12:27:21 PM »
Here is his post that should answer your questions:

NGUI 3 Support / Re: Adding and Removing elements from Scrollview
« on: June 13, 2014, 12:21:51 PM »
Unfortunately, I cannot as we're using Unity 4.3.3. Is this a known issue that's fixed in a later version of NGUI?

NGUI 3 Support / Re: Adding and Removing elements from Scrollview
« on: June 12, 2014, 07:13:05 PM »
I figured out some more.

If I turn off "Smooth Tween" on the UIGrid it works perfectly.

So this is my theory:

I remove the first element in the grid, then Reposition() is called, but it hasn't tweened yet. Then ResetPosition() is called and it changes the position based on the actual items, not the size of the grid. Then after it does that, the tween ends and shoves all the items up one position so the first element is now above the clip.

That may not be what's happening, just my theory. How do I solve it? I can wait until the tween ends and then call ResetPosition(), but then I'm waiting for this nice smooth animation to go off and then jerking it into place.

NGUI 3 Support / Adding and Removing elements from Scrollview
« on: June 12, 2014, 06:54:57 PM »
NGUI 3.5.9

I have a scrollview with a grid and a bunch of elements. I'm adding and removing them at runtime and running into a weird issue where removing elements causes the grid to be scrolled up outside of the visible clip zone. I can either drag the contents back into view, or I can execute the "Reset Clipping Position" manually in the editor. Here's the code I'm using to remove elements:

  1. void Foo() {
  2.         foreach (Transform child in _grid.transform) {
  3.                 if (childMatchesCondition()) {
  4.                         NGUITools.Destroy(child.gameObject);
  5.                         break;
  6.                 }
  7.         }
  9.         _gridScrollView.ResetPosition();
  10.         _grid.GetComponent<UIGrid>().Reposition();
  11. }

It seems like it's the grid Reposition() that messes it up. If I just do ResetPosition, the list always lines up at the top of the scrollview (but then I get gaps), but if I call Reposition, it will sometimes shift up so one element is above the scrollview clip.

What I expect:
  1.  ___
  2. | @ |
  3. | @ |
  4. | @ |
  5. -----

What I get:
  1.  _@_
  2. | @ |
  3. | @ |
  4. |   |
  5. -----

With some larger scroll views that I have, if I filter it down to only a few elements they will often scroll all the way off the top of the screen and I can't see any of them.

Thoughts anyone? This seems like a pretty standard use case so there must be an easy way to do this properly.

I see. That does as you say. I guess I was expecting it to hard lock it to the container, not snap it back. Oh well.

I'm not using a scroll view. I don't know where you got that from.

I simply have a UIDragObject that I want to contain within a panel. I want to be able to drag it around, but have it bump up against the edges of a container. If I put it into a panel and turn on alpha clip it won't draw outside of the panel, but I want it to be prevented from moving outside of it.

Essentially I have buttons I want to swipe to activate. Perhaps I'm over-complicating things and there's a better way to do that.

Because it's neither a scroll view nor a drag and drop use case?

I have buttons that I want to drag to activate instead of clicking on them. They only move horizontally, and I only want them to drag so far.

I created an empty scene, made a containing Panel and set it's clip to alpha and then added a button outside the Panel's hierarchy and made it a Draggable Object. This works. Then I made the button's drag effect none (from MomentumAndSpring) and that sort of works. The button has bounds, the bounds seem to depend on the button's current location and not the panel (not sure if that's a bug or I'm doing something wrong). Then I moved the button underneath the panel in the hierarchy and I could no longer drag it. Changing drag effect to MomentumAndSpring makes it work again, but the combination of None and being under the clipping panel in the hierarchy breaks the drag.

Also the strange part of it is that the widget is drawn correctly in the editor, but not when I run the scene.

Pages: [1] 2