Hi! Great package, i am using it for a while.
I have a problem and i am not sure how to resolve it.
I have draggable panel with grid inside that holds gui elements dynamically added.
i need to draw 2d line (with another package) and i need to get viewport coords of
elements inside the draggable panel (under grid).
i am not sure what i need to be using (position,localPosition, WorldToViewport or WorldToScreen and what camera for converting coords)
here is what i have tried:
GameObject s = NGUITools.AddChild(grid,microlabel2DPrefab);
s.GetComponentInChildren<UILabel>().text = ml.GetName();
grid.GetComponent<UIGrid>().Reposition();
Vector3 mPos = GameCam.WorldToViewportPoint(ml.GetStartPos());
Vector3 gPos = GameCam.WorldToViewportPoint(s.transform.position);
VectorLine l = VectorLine.SetLine(lineColor,gPos,ml.GetStartPos());
ml is just GameObject with Transform
and s i prefab that is put in grid inside draggable label
i want to draw 2d line from element in the grid to projected 2d position of gameobject.
any help appreciated!
[EDIT]: just to add that gui element is visible only by Ngui cam and object in the scene with gamecam. the usual setup.