how to get relative position of a game object with respect to parent

i have a panel that contains an image, and that panel is child of some other game object.
i need to calculate the position of panel with respect to parent object.
for now as its local position is 0,0 but globally it starts at almost half of the width of the parent.
how can i get the relative position of this panel game object?
or can check where in the whole plane/scene this game object resides?

Check out transform.TransformPoint, it will transform whatever vector3 (position) to world space

If you want the position of a UI object relative to it’s parent don’t use transform.localPosition. UI objects (I assume you’re using the new UI on Unity 4.6) have a Rect Transform. You can get the component with GetComponent or cast the transform to a RectTransform.

Once you have the RectTransform you can access the values you setup in the inspector using some of this things: Unity - Scripting API: RectTransform

Depending on the anchor reference you used those values mean different things, but maybe anchoredPosition is enough (it’ll return the values for “pos x” and “pos y” fields on the inspector)