When making a GUI follow a GO, make so it wont be resized

Still on that lighting system i’m working on id like to, when debugging and testing, the dev team have the option to not only see the light source represented as a lamp but also have below this sprite its id object so it can have its properties altered in real time. In real game scenario, with no test and stuff, the game would never draw these lamps and their ids. But back to the problem, this is what it looks like while debugging and testing with a far camera:
image
and with the camera reall close to the lamp:
image

note that the lamps sprites in billoboarding, do have a fixed scale, while the gui components do NOT have a fixed scale and will get bigger or smaller based on the distance of the camera. What id like to do is to have the GUI in a fixed scale. For that i could render them in the world space. That turned out to be quite difficult, since gui components only accept world space vertices, so no billboarding for them. Any help is appreciated!

I’ve never tried it myself so it might be a dead end, but have you looked into using Labels instead of GUI nodes? Since they are separate components like Sprites and already meant to be rendered in world space.

2 Likes

Yes, definitely try using a label component instead!

But what if i want a gui object like a health bar to follow a NPC? Should i open a request in github for this?

1 Like

One option is to use a sprite with slice-9 texturing.

1 Like

cant do billboarding in sprite component, have tried in the past, even the lamp is just a quad, sprite wont allow local vertices.

Edit: Well, guess i can do billboarding on CPU then

OK, I wasn’t sure how the billboarding stuff worked. If this is really only for limited debugging purposes, then yeah, I would just do the most simple thing and add an object with a label and a script that rotates it towards the camera.

The other option is to scale the GUI text node. I don’t know the math off the top of my head, but you should be able to take the FOV of your camera, the distance to the camera, and…the viewport dimensions?, and calculate the scale to keep it a uniform size on screen.