Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

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!