Search Unity

Show stamina points when picking up a object

Discussion in 'Scripting' started by SeeleyBooth, Apr 16, 2014.

  1. SeeleyBooth

    SeeleyBooth

    Joined:
    Jan 23, 2014
    Posts:
    30
    Ok so in c# i have a the script set so when the player runs into a object on the ground it adds a certain amout to the stamina meter.

    What I cant figure out is say I want to show some text located at position of the object. I now how to instantiate a prefab at the location. But I want to instantiate some gui text. Is this possible?
     
  2. Errorsatz

    Errorsatz

    Joined:
    Aug 8, 2012
    Posts:
    555
    Yes. You'll need to convert the point in world space to a point in screen space, and position the gui text there.
    Check out Camera.WorldToScreenPoint.
     
  3. SeeleyBooth

    SeeleyBooth

    Joined:
    Jan 23, 2014
    Posts:
    30
    That was it. Got it working. Thanks for the help!