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
- "Shader warning in 'Hidden/Light2D': implicit truncation of vector type" is thrown when building Universal 2D template
- AI Assistant breaks compilation of packages using System.Runtime.CompilerServices.Unsafe via auto-referencing
- Unity Hub checks the "Documentation" module by default on the 6.4 and 6.5 streams despite that it was unchecked with the previous installs
- Shortcut that toggles between Dopesheet and Curves Views in the Animation Window's Timeline is mislabed
- Property List Items Overlap onto the Property List's top edge when scrolling through a long Property List
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.