Search Issue Tracker
Won't Fix
Won't Fix in 6000.0.X
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
- Shader Graph Node information is briefly displayed in Graph Inspector when clicking on Category in the Blackboard
- Module installation fails with "Download failed: Validation Failed" errors when using beta.2 Hub version
- JsonConvert conversion fails trying to call GetCallbackMethodsForType when [OnDeserialized] is used in a class
- Shader Graph Category dropdown cannot be expanded/collapsed when clicking on the text
- Different text alignment in the column header in Entities "System" window
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
Resolution Note (6000.0.X):
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