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
- [HDRP] Volumetric cloud shadows disappear when there is no directional light shadows
- “Selector” column names in the Search window are lowercase when added
- Install List Project Counter Panel can be right clicked through and Install Context Menu can be opened disabling Project Counter Panel's buttons
- Scene is marked/flickering as dirty (with asterisk) when dragging a Material on a GameObject in Scene view
- Warning icon for the "Asset Import Overrides" has low visibility in Light Unity theme
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");
}
}