Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: thewill786 on August 14, 2012, 09:55:47 AM
-
I came across a problem that would cause a panel to move behind other objects causing its contents to disappear when dragging. After some investigation I realised the z component of the transform was being set to a very small non-zero value, I imagine due to floating point error in one of the previous operations. I changed my UIDraggablePanel.MoveRelative to
void MoveRelative (Vector3 relative)
{
mTrans.localPosition += relative;
if (mTrans.position.z != 0.0f)
{
Debug.LogError("Z problem found. Correcting!");
mTrans.position =
new Vector3(mTrans.position.x,
mTrans.position.y,
0.0f);
}
Vector4 cr = mPanel.clipRange;
cr.x -= relative.x;
cr.y -= relative.y;
mPanel.clipRange = cr;
UpdateScrollbars(false);
}
and this fixed the problem. However I don't know if this will cause problems elsewhere?
Will appreciate any thoughts on this! Thanks.
-
It could cause issues elsewhere if you use the z position on elements to help order things via depth. If not you should be ok
-
Yes - I had to remove that indeed as it caused problems elsewhere.
I'm having a real hard time setting up a simple scrollable panel with objects inside. I need it to stretch with the screen.
Is there a tutorial explaining the process of creating the scrollable panel. I know there's an example, but it's not easy to understand, and moving one part of it seems to break everything else for no reason.
-
Just a note, I followed the steps in this tutorial, http://www.tasharen.com/?page_id=4444
You never mention how to create the colliders in it?
-
Via the NGUI menu. It's mentioned in a comment below. You can also use Alt+Shift+C.
-
Okay. Here's what I've been struggling with.
I figured out how to create a clippable panel that stretches and repositions itself according to the screen size.
Now I need the contents of the panel to be aligned to the left of the panel. I want the contents to scroll vertically.
Any help would be appreciated. Thanks.
-
Use the same logic, or UIAnchor the parent object (object above the panel).
-
hi, you said you had found out how to create a clippable panel that stretches and repositions itself according to the screen size. can you tell how to do it, thanks!