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
- Mono Windows Builds don't produce full log callstacks when generating logs
- AssetBundles fail to load when running in Built Players for Mobile Devices
- UI elements with text gets bigger and grey when Player window is moved to another screen with different resolution
- System name accepts multiline text but crops it on confirmation, duplicates input, and shrinks the field when empty
- UI element scale and position are wrong in project build when DRS is changed with HDR and Software Dynamic Resolution enabled
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");
}
}