Text on a gameobject (DEF-1332) (SOLVED)

Hi, is there a way to write text on a gameobject, so that it would move on the screen with it? There are many instances of this gameobject, and I want to update text on all of them. Using GUI does not seem very convenient for that.

There’s currently no option other than overlaying a text node from a gui and manually making it follow the game object. A text component is in the backlog and with a fairly high priority if I’m not mistaken.

2 Likes

Thanks, that’s what I thought.

Yes, sorry about that. Maybe someone has a Lua module to share that takes care of some of the work of keeping a text node aligned with a game object? There’s of course considerations that has to be taken when it comes to the render script, but in general I think a bit of the work could be generalised.

Being able to put text on gameobjects would be very convenient! We’re porting a word game, and I don’t think the proposed work-around works for us, since we’re using a factory to generate blocks with words on them.

Since Defold version 1.2.76 there’s an option to disable the adjust mode of a Gui scene. Select the Gui root in the Outline and set Adjust Mode to Disable in the properties windows. With this change you will be able to alter your render script in such a way that you can draw the Gui with the same view and projection as you draw sprites etc. This will make it a lot easier to have text nodes follow game objects.

2 Likes

Defold 1.2.92 introduced a Label component that will allow you to very easily add text to game objects. Defold 1.2.92 has been released

4 Likes