Search Issue Tracker

By Design

Votes

0

Found in

2021.3.34f1

2022.3.19f1

2023.2.8f1

2023.3.0b6

Issue ID

UUM-62350

Regression

No

Emission property in material can’t be changed when using script if the initial value in the material is black

-

How to reproduce:
1. Open the user’s attached “setEmission.zip” project
2. Enter Play Mode
3. Press the “Spacebar” button
4. Observe the result

Expected result: Plane’s color has changed
Actual result: Plane’s color doesn’t change

Reproducible with: 2021.3.34f1, 2022.3.19f1, 2023.2.8f1, 2023.3.0b6

Reproduced on: macOS 14.2.1 (Intel)
Not reproducible on: No other environment tested

Note: not reproducible if materials emission color is not black

  1. Resolution Note:

    The user needs to enable the emission keyword after updating the color for the change to take effect. So the script should be:

    void Update()
    {
    if (Input.GetKeyDown(KeyCode.Space))
    {
    isOn = !isOn;
    if (isOn)
    {
    r.material.SetColor("_EmissionColor", emissiveOn);
    }
    else
    {
    r.material.SetColor("_EmissionColor", emissiveOff);
    }
    r.material.EnableKeyword("_EMISSION");
    }
    }

Add comment

Log in to post comment