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
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Texture2D hash changes inside of an AssetBundle when rebuilding a SpriteAtlas bundle with an empty AssetPostprocessor Script enabled
- Aniso Level still applies when Generate MipMap is disabled in Texture Import Settings
- Mipmap Limit Groups long names are not truncated when creating a new Mipmap Limit Group with a long name
- “ArgumentException: Invalid double parameter.” error is thrown when Infinity is typed into the Fixed Timestep field
- GameObject becomes gray when using HDRP and STP together on macOS
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");
}
}