Search Issue Tracker
By Design
Votes
0
Found in
2017.4
2019.3.2f1
2020.2
Issue ID
1223405
Regression
No
UI Image element's diffuse texture is not updated when shaders are switched
How to reproduce:
1. Open user's 'UI Default Shader Texture.zip' attached project
2. Open 'SampleScene' Scene
3. Select 'Material' material in Project Browser
4. Change UI/Default shader to Standard shader in the Inspector
5. Change the Albedo texture map to 'Green' texture
6. Change shader from Standard to UI/Default shader
Expected result: 'Image' GameObject is red in the Scene View and GameView
Actual result: 'Image' GameObject is green in the Scene View and GameView
Reproducible with: 2017.4.38f1, 2019.4.19f1, 2019.3.6f1, 2020.1.0b2, 2020.2.0a3
Notes:
- Video of reproduction attached in Edit
- _MainTex property is properly updated when using primitive meshes
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
- Articulation Body with 'Revolute' Joint Type has erratic behavior when Upper Limit is set to above 360
- WebGL Player fails to render Scene when Terrain with Detail Mesh is added and WebGPU Graphics API is used
- Inconsistent errors are logged when different types are passed into the Query "Q<>" method in UIToolkit and the ancestor VisualElement is null
- Crash on GetMaterialPropertyByIndex when opening a specific Scene
- Discrepancies in the styling are present when using a TSS file instead of a USS file in custom EditorWindow
Resolution Note (2020.2.X):
This is how the image component works. by default the UI uses a sprites texture as its _MainTex. If there is no sprite it falls back to the assigned materials mainTexture. If there is no material assigned or not texture on that material it falls back to a white texture.
The reason its not shown in the inspector is the property on the shader is a PerRendererData type so its not something thats assigned in the asset.
As for why it doesnt update until its in play mode, while thats just a inherient issue inside of Unity. We have no way of tracking (without causing large editor performance issues) when a material has changed to force the element to rebuild its rendering. As the UI is built into a single mesh with the batcher unless we know we need to rebuild the batch it will keep drawing what it already has.