- Home /
Make GUI follow the object
Hi!
I am making some kind of colony simulator and I want when you press a human you get a info box. The info box will follow the NPC. But I can not get the box to follow it. And don't redirect me to some WorldToScreenPoint nonsense. It doesn't help me. I can not get it to work in any way even if I simply copy the script line by line. This is what I gave up on.
void OnGUI(){
var point = Camera.main.WorldToScreenPoint(transform.position);
GUI.Label(new Rect(point.x, Screen.currentResolution.height - point.y - 200, 200, 200), "Blerh");
}
why are you using GUI, you could just use 3D Text or sprite?
Answer by $$anonymous$$ · Nov 10, 2014 at 09:38 PM
Although you could use http://docs.unity3d.com/ScriptReference/Camera.WorldToScreenPoint.html
@Le_Vailus I can not get this WorldToScreenPoint to work in any way so don't redirect me to it and I want to use the GUI because it is easy to work with.
Is this a joke? If it doesn't work "in any way", tell us what you tried and if what errors there are. It is the way to go for your problem.
Your answer
![](https://koobas.hobune.stream/wayback/20220613171206im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
GUI Follow Object On-Screen 1 Answer
How do I position a GUI Label over an object? 1 Answer
Level select design approaches. 0 Answers
Gameobject shown as GUI 1 Answer
Rotation Object Follow Help 2 Answers