How to make Text emissive?

I’m trying to make text glow with Bloom, but I can’t seem to find a way to get an emissive material. Is it possible?

Original Post on Discord

by user 300386587278049291

Hey :wave: you should be able to just set the color property to something above <0,1> range

    @serializable(Text)
    text?: Text;

    update(): void {
        if(!this.text) return;
        this.text.color.r += this.context.time.deltaTime;
    }

image.png

If you want to streamline it a bit more, you can make a HDR color property in Unity like so:

Typescript

import { Behaviour, RGBAColor, serializable, Text } from "@needle-tools/engine";

export class GlowingText extends Behaviour { 

    // @nonSerialized
    @serializable(RGBAColor)
    color: RGBAColor = new RGBAColor(1, 1, 1, 1);

    awake(): void {
        const text = this.gameObject.getComponent(Text);
        if(text) {
            console.log(this.color);
            text.color = this.color;
        }
    }
}

CSharp

using UnityEngine;

// NEEDLE_CODEGEN_START
// auto generated code - do not edit directly

#pragma warning disable

namespace Needle.Typescript.GeneratedComponents
{
    public partial class GlowingText : UnityEngine.MonoBehaviour
    {
        public void awake(){}
    }
}

// NEEDLE_CODEGEN_END

namespace Needle.Typescript.GeneratedComponents
{
    public partial class GlowingText : UnityEngine.MonoBehaviour
    {
        [ColorUsage(true, true)]
        public Color @color;
    }
}

The attribute Color Usage enables the intensity in the color picker → Which results in values that are larger then <0, 1>

Wow so simple! Can’t believe I didn’t try this :laughing: thank you so much for the explanation and code snippets!

by user 300386587278049291

Yeah, i jumped the ship as well. First i wanted to edit the shader… hit a dead end. Then i edited the color directly on the TMUI component :smile: and then i tried the color property :smile: slowly domming it down.

Will be also apart of a new samples release :smile: