- Home /
How to make a GUI Texture follow a moving gameobject?
Hello, the game I am working on is a traffic management game. When A vehicle stops I want a GUI texture to pop up over it. This is in an isometric view cause when I attache GUI elements to a GO it just pops ups on the main camera.
Answer by Bulalord609 · Feb 16, 2017 at 09:03 AM
Found the easiest solution! Just the the vehicle GO as the parent of the canvas and the canvas will follow the GO around.
Answer by GiyomuGames · Feb 15, 2017 at 02:44 AM
You could use a GUITexture that is on a canvas set in "word space". Therefore you can just set its position like you would for a game object.
I did this the problem is that the canvas needs to follow the position of the GO. I'll try to set the GO as a parent of the canvas. I'll keep you posted if I get it working. Thanks for the advice!
I don't think the canvas has to move at all, only your GUITexture should. Just make sure to update its position as the object it's pointing at moves.