Flying sprites towards score (as a GUIText) Unity2d

I am trying to add some pizzaz to the game interface. I have my score as a guitext in my game, its always in the upper left corner. I would like to once the player gets a coin fly that coin up to the guitext . I know how to do the movetowards and all that, but not sure how to get where that guitext is in game coordinates? Getting the transform position I am doubting will work and I probably need some
Camera.main.ViewportToWorldPoint call or something, but I am not sure how to get a GUITexts coordinates? There is a pixel offset I see but guessing I need to add that back into some known number.

I am thinking getting the guitext location in screen coordinates is not what I want, but its the only way I can think to have my coin pickups fly there once picked up.

I would create a dummy object and attach it to your camera and place it in the desired spot if the location isn’t going to change. If you need it to move it dynamically you could just measure screen in game units and multiply it by the GUIText coords. I think they’re 0,0 - 1,1 so it should act like a %age.

Something like LeftEdgeOfScreenPosition + (ScreenWidth * GUITextXOffset) will give you the x coord and you can do the same for y.

Wow that makes a lot of sense, with it attached to the camera… the zooming wouldn’t effect.

Going to try this!

Okay actually will have to go the other way, the target position changes when screen moves (another duh on part). That LeftEdgeOfScreenPosition how does one get that? guessing I alternatively want the BottomEdgeOfScreenPosition?

Ah zoom would make that a lot more complicated. I was thinking you would use an object attached to your camera to find the position of the left edge of the screen.

Anyway, I did a little digging and it looks like this will do exactly what you initially asked for:

ViewportToWorldPoint(new Vector3(guiText.pixelOffset.x, guiText.pixelOffset.y, camera.nearClipPlane));

The strangest thing is, the above results in the coins following the player not going for the gui.

    Vector3 pos = Camera.main.ViewportToWorldPoint(new Vector3(hudToFlyTo.guiText.pixelOffset.x, hudToFlyTo.guiText.pixelOffset.y, 0f));


        transform.position = Vector3.MoveTowards(new Vector3(this.transform.position.x, this.transform.position.y, 0f), pos, moveSpeed * Time.deltaTime);
        if(transform.position == pos)
        {
            Destroy(gameObject);
        }
        Debug.Log ("pos: " + pos);
        Debug.DrawLine(pos, transform.position);

Sure enough that debug pos print is the players coordinates…I am not sure where this is coming from it is totally separate. hudToFlyTo is a gameobject that has on it a guitext that is where my score is stored and displayed on the screen. I am so puzzled. If i take out the Camera.main.ViewportToWorldPoint call and just set pos = new (hudToFlyTo.guiText.pixelOffset.x, hudToFlyTo.guiText.pixelOffset.y, 0f));
then this almost works but it flies to the bottom middleish of screen.