Search Issue Tracker
Won't Fix
Votes
0
Found in
2021.3.12f1
2022.1.23f1
2022.2.0b15
2023.1.0a19
2023.2.0a1
Issue ID
UUM-20075
Regression
No
Material.HasTexture/HasProperty returns true for non-existent property after calling setTexture
How to reproduce:
1. Open the user-attached project “ShaderPropertyBug”
2. Enter the Play Mode
3. Observe the Console
Expected result: There is no error message because Material.GetTexture shouldn’t be called since Material.HasTexture is false
Actual result: There is an error message because Material.GetTexture is called
Reproduced with: 2021.3.12f1, 2022.1.23f1, 2022.2.0b15, 2023.1.0a19
Couldn’t test with: 2020.3.41f1 (Material.HasTexture can’t be called)
Reproduced on: Windows 11 Pro
Note: Also reproduced in Player
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
- ArgumentOutOfRangeException when manipulating the Project Settings search bar
- [Linux] Touch freezes in Player when any mouse button is clicked
- UnityEngine.Rendering.Volume.OnEnable() is called twice before OnDisable() creating multiple copies of the same volume when a volume is enabled right after Domain Reload when entering Play Mode
- Hinge Joint transforms are reset when toggling the "useMotor" property
- Motion Vector texture reports incorrect Mesh data when Mesh is coming from off-screen
Resolution Note:
After discussing with the team, we decided to postpone any significant behavior change to the existing interface. As mentionned by Juho Oravainen , material setters/getters should work independently from the shader assigned. We should then have a different set of functions to check if the shader assigned to the material has properties and what is set to it.
Right now the documentation is describing the current state of things. Set is setting both, material and shader. Has is looking at the shader and get is getting from the shader except for textures which get it from the material. I tried to change the existing behavior of the texture getter but I ran into failing tests on the graphic side which hint me that it might be a more important breaking change than I thought in first place.
We are looking forward to refactor this in a version post 2023.x.