From 435c522b0ce59db0e8f167cb70e784b0cdc899d3 Mon Sep 17 00:00:00 2001 From: DCFApixels <99481254+DCFApixels@users.noreply.github.com> Date: Fri, 28 Feb 2025 12:38:59 +0800 Subject: [PATCH] final text background fix --- Runtime/Gizmos/DebugX.text.cs | 5 +---- Runtime/Shaders/TextBackground.shader | 14 ++------------ 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/Runtime/Gizmos/DebugX.text.cs b/Runtime/Gizmos/DebugX.text.cs index 7188307..b84dd9f 100644 --- a/Runtime/Gizmos/DebugX.text.cs +++ b/Runtime/Gizmos/DebugX.text.cs @@ -80,11 +80,8 @@ namespace DCFApixels if (!(WorldToGUIPointWithDepth(camera, item.Value.Position).z < 0f)) { Rect rect = WorldPointToSizedRect(camera, item.Value.Position, _labelDummy, _labelStyle); - Color backgroundColor = item.Value.Settings.BackgroundColor * GlobalColor; - backgroundMaterial.SetColor(ColorPropertyID, backgroundColor); - Graphics.DrawTexture(rect, _whiteTexture, backgroundMaterial); - + Graphics.DrawTexture(rect, _whiteTexture, new Rect(0, 0, 1, 1), 0, 0, 0, 0, backgroundColor, backgroundMaterial, -1); GUI.color = item.Color * GlobalColor; style.Draw(rect, _labelDummy, false, false, false, false); } diff --git a/Runtime/Shaders/TextBackground.shader b/Runtime/Shaders/TextBackground.shader index 6266f5d..c1ca2f1 100644 --- a/Runtime/Shaders/TextBackground.shader +++ b/Runtime/Shaders/TextBackground.shader @@ -1,9 +1,5 @@ Shader "DCFApixels/DebugX/TextBackground" { - Properties - { - _Color ("Color", Color) = (1,1,1,1) - } SubShader { Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" "PreviewType"="Plane" } @@ -25,7 +21,6 @@ Shader "DCFApixels/DebugX/TextBackground" { float4 vertex : POSITION; float4 color : COLOR; - UNITY_VERTEX_INPUT_INSTANCE_ID }; struct v2f @@ -34,24 +29,19 @@ Shader "DCFApixels/DebugX/TextBackground" float4 color : COLOR; }; - UNITY_INSTANCING_BUFFER_START(Props) - UNITY_DEFINE_INSTANCED_PROP(float4, _Color) - UNITY_INSTANCING_BUFFER_END(Props) - float4 _DebugX_GlobalColor; v2f vert (appdata_t v) { v2f o; - UNITY_SETUP_INSTANCE_ID(v); o.vertex = UnityObjectToClipPos(v.vertex); - o.color = v.color * UNITY_ACCESS_INSTANCED_PROP(Props, _Color) * _DebugX_GlobalColor; + o.color = v.color * _DebugX_GlobalColor; return o; } float4 frag (v2f i) : SV_Target { - return i.color * float4(1, 1, 1, 2); + return i.color; } ENDCG }