How to reproduce:
1. Open the user’s attached “SetSharedMaterialsBug.zip” project
2. Open the “MaterialBug.cs” file (Assets > MaterialBug) and comment out line 22 and uncomment line 25
3. In the Hierarchy window, select “Cube” GameObject
4. Enter Play Mode
5. Observe the Materials of the “Mesh Renderer” Component in the Inspector window
Expected result: There is one material “SwapTo”
Actual result: There is one material “SwapTo” and three 3 “None (Material)”
Reproducible with: 2022.2.16f1, 2023.1.0b12, 2023.2.0a11
Could not test with: 2020.3.47f1, 2021.3.23f1 ('MeshRenderer' does not contain a definition for 'SetSharedMaterials’)
Reproduced on: macOS 13.2.1 (Intel)
Note: Not reproducible with “sharedMaterials”