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
- var VisionOSEDRHeadromm has a comma instead of a dot when building with Metal Rendering App Mode and local OS localization is set to German
- IAP Catalog remove product “x” and add product “+” buttons are not consistent with other remove and add buttons in the Editor
- Performance issues in Play Mode when quickly hovering the mouse cursor over Hierarchy GameObjects
- Frame Debugger displays incorrect output when FidelityFX Super Resolution or Spatial-Temporal Upscaler is used with Temporal Anti-aliasing or Subpixel Morphological Anti-aliasing
- The layout system is failing to correctly calculate or apply the height of the Japanese fallback font when the primary English font's metrics are used
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");
}
}