Hi, I would like to get the current camera so I can tween a panel in from outside the camera view/bounds.
I have tried various methods: UICamera.current return null, NGUITools.FindInParents<UICamera>( gameObject ) returns null.
To make things a little more confusing I have two UIRoots and therefore two UICamera.
UIRoot1
- UIPanel
- UICamera
UIRoot2
-UIPanel
-UICamera
SO just to reiterate what I am doing. In code I am trying to tween an existing object in the hierarchy. I want to position it outside the view of the camera and tween/slide it in.
Any suggestions?
Also related to my issues I have managed to get my panel to appear offscreen with the following code:
int paneloffset = Mathf.FloorToInt( UIRoot.GetPixelSizeAdjustment( gameObject ) * ( Screen.width / 2f ) ) + 1;
paneloffset += 480;
gameObject
.transform.localPosition = new Vector3
( -paneloffset,
0,
0 );
My Panels have been designed to be 960px wide so I am adding 480 pixels to the offset. Is this okay or will I run into problems with this approach?
Thanks