How add backgroud color to DynamicTexture

How add backgroudcolor to DynamicTexture? is there the possibility of adding background color?

My initial example:

Hi @Dieterich
Just add clearColor :slight_smile:

texturaInfoObjeto.drawText(txt, null, 140, 'bold 80px arial', 'yellow', 'black')
1 Like

@aWeirdo thanks! that’s easter egg, so hidden…

Taking advantage of the question, how can I make a line break?

Afraid drawText doesn’t support linebreaks as far as i know.

But you can do it in many ways.
One simple example, keeping lines as multiple strings in an object.

    if(typeof txt === "object"){
        for(var i = 0; i < txt.length; i++){
            texturaInfoObjeto.drawText(txt[i], null, 100 + (fontSize * i), 'bold '+fontSize+'px arial', 'yellow', (i === 0 ? 'black' : null) )
    else {
        texturaInfoObjeto.drawText(txt, null, 100, 'bold '+fontSize+'px arial', 'yellow', 'black')
1 Like

Wooww that’s so helpful!
Last question :slight_smile:, can be possible align the text in vertical?


Perhaps you should use GUI if you think about using complex texts
GUI is based on a texture that you can easily reuse and provide the TextBlock control that has all that you need

1 Like

@Deltakosh well remembered! thanks!:grin: