Quantcast
Channel: Answers for "Trying to draw GUI.Label() at object position"
Browsing index pages (9 articles)
↧

Answer by alejandro__

So in case that anyone falls in here, here's a solution with code: private string text; void OnGUI() { var position = Camera.main.WorldToScreenPoint(gameObject.transform.position); var textSize =...

View Article


Answer by Lone-Coder

Here's what I'm using. It's not perfect but close enough for debugging. Any idea on how it could be fixed? void OnGUI() { var point = Camera.main.WorldToScreenPoint(transform.position); GUI.Label(new...

View Article


Answer by kennypu

Ok I figured out what was going on. Apparently, the WorldToScreenPoint and WorldToViewportPoint functions return an integer(or float respectively) starting from 0,0 at the BOTTOM LEFT of the screen....

View Article

Answer by PrimeDerektive

Did you try setting a custom gui style to the label and playing with the alignment of the text? That sometimes throws me off.

View Article

Answer by DaveA

Just a guess, but try using p.z where you have p.y right now.

View Article


Answer by Lone Coder

Here's what I'm using. It's not perfect but close enough for debugging. Any idea on how it could be fixed? void OnGUI() { var point = Camera.main.WorldToScreenPoint(transform.position); GUI.Label(new...

View Article

Answer by kennypu

Ok I figured out what was going on. Apparently, the WorldToScreenPoint and WorldToViewportPoint functions return an integer(or float respectively) starting from 0,0 at the BOTTOM LEFT of the screen....

View Article

Answer by PrimeDerektive

Did you try setting a custom gui style to the label and playing with the alignment of the text? That sometimes throws me off.

View Article


Answer by DaveA

Just a guess, but try using p.z where you have p.y right now.

View Article

Browsing index pages (9 articles)


Latest Images