How to dim a glowing material?

I want my player to be glowing, and it seems I can do it as screenshot that is attached to this post…
But how do I change the intensity from a script?

    private Material playerMaterial;

    void Start()
    {
        playerMaterial = GetComponent<Material>();
        playerMaterial.??
    }

Or should I do it in another way?

if you do right click select shader, can see those property names,
its probably that _EmissionColor

1 Like

Thanks, that is big help. But Im not getting it to work since _EmissionColor only takes a color It seems like. And color does not contain a parameter for emission, only color+alpha which does not help…

playerColor = new Color(255, 255, 0, 255);
rend = GetComponent();
rend.material.SetColor(“_EmissionColor”, playerColor);

apparently need to do one of these,

I found a way! You can set the intensity by multiplying the color. Sounds crazy but it´t true
So to fade the intensity I can write “rend.material.SetColor(”_EmissionColor", playerColor * playerLjus)" :

        playerColor = new Color(255, 255, 255, 255);
        rend = GetComponent<Renderer>();

        playerLjus = 0.005f;
    }

    private void FixedUpdate()
    {
        playerLjus = playerLjus - 0.00001f;
        Debug.Log("playerljus = " + playerLjus);
        rend.material.SetColor("_EmissionColor", playerColor * playerLjus);