So, there is no way to write arbitrary text on arbitrary game objects, etc yet? (DEF-1332) (SOLVED)

I was thinking of doing things with texts. Such as make damage numbers flying out from things on hit. Or make a game about a work table full of titled folders and photos. But it looks like only way to easy work with text is GUI, and it is made of singleton nodes, right?

1 Like

For simple battle damage text, you could use tilemaps with a fixed width font if you do not want to use the GUI method.

1 Like

So, I make a prototype node, then gui.clone it and move/change it around. It’s a weird way of doing things, but it works, thanks!

It can’t be behind the sprites, though…

With the default render script, no. The GUI material stuff is drawn last. But you can change that, or add a new material and draw before sprites.

1 Like

There is actually work ongoing in the engine team this current sprint to design text as a game object component. Note that this is only the technical design part of the work. The actual implementation will have to be done sometime after the design work is completed. I don’t know when.

Until we have a proper text component to attach to our game objects there are a number of different solutions to the things you want to solve:

Flying damage numbers
This could be solved by either spawning text nodes and rendering them in a separate pass or by having the numbers 0-9 as sprites and spawning game objects with these sprites to form the numbers you need

A game about a work table full of titled folders and photos
I would create this game using a gui scene with text and box nodes instead of a a bunch of game objects. This has the added benefit of being able to load images dynamically to set them as textures on some box nodes.

But yeah, in the end it would still be nice to have a proper text component. Luckily it doesn’t seem that far off in the future!

3 Likes

Defold 1.2.92 introduced a Label component for game objects. This will make it very easy to add text to game objects. Defold 1.2.92 has been released

3 Likes