From 583b438becf9a061ddbd1269d6370f8eeadb017d Mon Sep 17 00:00:00 2001 From: RC-TylerEgger <117413134+RC-TylerEgger@users.noreply.github.com> Date: Thu, 16 Oct 2025 15:21:41 +1100 Subject: [PATCH] Fixed BlendAlpha mode broken in Unity 6.2 Resolved issue with BlendAlpha on all SimpleLit materials being forced to Zero/Zero by explicitly defining parameters in subtarget. This was causing passthrough mode for MetaXR to show over all opaque objects, making them appear transparent --- .../Targets/UniversalSimpleLitSubTarget.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Editor/ShaderGraph/Targets/UniversalSimpleLitSubTarget.cs b/Editor/ShaderGraph/Targets/UniversalSimpleLitSubTarget.cs index 59a66de..f1260f8 100644 --- a/Editor/ShaderGraph/Targets/UniversalSimpleLitSubTarget.cs +++ b/Editor/ShaderGraph/Targets/UniversalSimpleLitSubTarget.cs @@ -190,6 +190,17 @@ public override void CollectShaderProperties(PropertyCollector collector, Genera #endif collector.AddFloatProperty(Property.SrcBlend, 1.0f); // always set by material inspector, ok to have incorrect values here collector.AddFloatProperty(Property.DstBlend, 0.0f); // always set by material inspector, ok to have incorrect values here + // Set alpha blend defaults based on surface type + collector.AddFloatProperty(Property.SrcBlendAlpha, 1.0f); // One - used for both opaque and transparent + if (target.surfaceType == SurfaceType.Opaque) + { + collector.AddFloatProperty(Property.DstBlendAlpha, 0.0f); // Zero for opaque + } + else + { + collector.AddFloatProperty(Property.DstBlendAlpha, 10.0f); // OneMinusSrcAlpha for transparent (always set by material inspector) + } + collector.AddToggleProperty(Property.ZWrite, (target.surfaceType == SurfaceType.Opaque)); collector.AddFloatProperty(Property.ZWriteControl, (float)target.zWriteControl); collector.AddFloatProperty(Property.ZTest, (float)target.zTestMode); // ztest mode is designed to directly pass as ztest