How can I hang something in the corner of the screen?


I’m learning Unity for 2 weeks only so I don’t know many things.
I need to have something in a left corner - a picture of a coin (Sprite) and 3D-text child to it with the number of coins I collected (because gui text uses viewport and cannot be parented).

So, 1st thing I tried is to have a MainCamera parent to my coin, but, of course, when I try different screen sizes - it goes offScreen.

So I made a script in void Awake() to change coordinates of a coin using camera.ScreenToWorldPoints … but as it has being parented by a camera - it goes off the screen.

Then I thought may be I don’t need a parent camera , so I wrote changing of coordinates to void Update() using same ScreenToWorldPoints. But , using it on Update make my sprite jumping around sometime and visually it looks bad.

So, please, help me, how can I hang some View (in my case, Sprite of coin with 3D text over it) so it would constantly hang in the left upper corner?

Why dont you use NGUI sprites with 2 which stick your object in corner on every screen size. Your Task will definitely be very easy by using NGUI sdk. It worked for me like a charm.

set the coin at parent to the camera, and
try to set the position of the coin like this :

   var valor:float = transform.localPosition.z;
   var valor2:float = transform.localPosition.x;
// percentage is values between 0 and 1;
   var percentagex : float=-1;
   var percentagey : float=1;
// this only works to a perspective camera with field of view marked to 60
    transform.localPosition.x = (((Screen.width*percentagex)/Screen.height)/2)*valor;   
    transform.localPosition.y = (((Screen.height*percentagey*2)/Screen.width)/2)*valor2;   

this will be fixed at a relative Screen position, scale and aproximate the coin (put the coin at upper border manually).

this works fine to me, with a perspective camera;