Search Issue Tracker
Won't Fix
Votes
0
Found in
2021.3.12f1
2022.1.21f1
2022.2.0b13
2023.1.0a17
2023.2.0a1
2023.3.0a3
6000.0.0b11
Issue ID
UUM-18067
Regression
No
Created materials specifically assigned to renderer.materials are cloned regardless when read back from renderer.materials
How to reproduce (simplified repro steps, see the original user report in the Comments for the original steps):
1. Open a new Scene
2. Create a Cube in the hierarchy
3. Attach "MaterialTestScript.cs" to the Cube
4. Create a Material asset in the project browser and name it "TestMaterial"
5. Drag the Material asset to the Material field of “Material Test” Script Component on the Cube
6. Enter Play Mode
7. Open the Settings of the "Material Test" Script Component in the Inspector (Three dots)
8. Press "Set Material"
9. Notice how the Material on the Renderer gets set to "TestMaterial"
10. Stay in Play Mode and again open the Settings of the "Material Test" Script Component
11. Press "Get Material"
Expected result: The Material on the Renderer does not change, it stays "TestMaterial"
Actual result: The Material on the Renderer changes to "TestMaterial (instance)"
Reproducible with: 2021.3.12f1, 2022.1.21f1, 2022.2.0b13, 2023.1.0a17, 2023.2, 2023.3
Couldn’t test with: 2020.3.41f1 (Script errors: “Tuple must contain at least two elements”)
Reproducible on: macOS Monterey 12.6 (Intel), Windows 10
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
- "Visual Effect Event Tester" Overlay is cut off when using the Scene View not in standard dimensions
- Visual Effect overlay has no tooltips for the playback controls
- Github link in the Rider tab of Preferences window has no padding on the left side and is not aligned with the other elements
- “Clear locked objects” button in the Info tab of the Physics Debugger window has no padding on the right side and has an extra space in between the words “locked” and “objects”
- Renaming the VFX Graph uses "Enter" for a new line and "Enter + Shift" to confirm instead of vice versa
Resolution Note:
This is expected behavior, you should use the sharedMaterial property to not instantiate a copy of the material
https://docs.unity3d.com/ScriptReference/Renderer-sharedMaterial.html