Search Issue Tracker
By Design
Votes
0
Found in [Package]
10.1.0-preview.5
Issue ID
1268504
Regression
No
Setting Material Color and Surface Type using MaterialPropertyBlock does not work when Surface Type is set to Transparent
How to reproduce:
1. Create a new HDRP Template project
2. Import the attached script named "MaterialTest.cs"
3. Click MaterialTest - > Create
4. Observe the two created Spheres in the Scene window
Expected result: One of the Spheres is rendered transparent with a red tint
Actual result: The Sphere is rendered either Opaque or extremely emissive depending on which Color constructor is used
Reproducible with: 2018.4.26f1(4.10.0), 2019.4.8f1(7.4.3), 2020.1.2f1(8.2.0), 2020.2.0a21(10.0.0-preview.27, 10.1.0-preview.5)
Notes:
1. If unityMaterial.SetColor("_BaseColor", new Color(128, 0, 0, 0f)) is used, the Sphere becomes extremely emissive. This is fixed by opening the material instance's properties and manually setting the same color using the Color wheel
2. If unityMaterial.SetColor("_BaseColor", new Color(1, 0, 0, 0f)) is used, the Sphere becomes opaque. This is fixed by by expanding material's properties
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
- Post Processing SMAA breaks when HDR mode R11G11B10 is selected and Color Space is changed
- The "UnityWebRequest.result" of the "UnityWebRequestTexture.GetTexture" method changes when accessing "UnityWebRequest.downloadHandler" texture
- Slider rounding does not allow setting certain valid numbers as Values when Low and High Values not set to default
- UI Builder Canvas has too big resizing zone on the outside of the canvas
- GetCurrentAnimatorClipInfoCount() and GetNextAnimatorClipInfoCount() return 0 when animator is in transition
Resolution Note:
The attached project has some mistakes in the material creation pattern. Certain keywords were missing that are mandatory for setting up a transparent object, which in turn caused the reported behavior.
We have decided that new c# helpers would make it easier to create materials from a script and avoid similar situations. This idea was added to our roadmaps, but currently, there is no ETA available when this new feature would land.