From 17ae9098bf5ae9f59f8f806a3389d0eba8e37115 Mon Sep 17 00:00:00 2001 From: shenjianxing <”315615051@qq.com“> Date: Fri, 9 May 2025 16:27:09 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E5=8F=8D=E9=A6=88=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Scripts/Item/Body3DObjItem.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Assets/Scripts/Item/Body3DObjItem.cs b/Assets/Scripts/Item/Body3DObjItem.cs index 4d3c56ca..dbd9df84 100644 --- a/Assets/Scripts/Item/Body3DObjItem.cs +++ b/Assets/Scripts/Item/Body3DObjItem.cs @@ -23,8 +23,7 @@ public class Body3DObjItem : MonoBehaviour private void Awake() { - shader = GetComponent()?.material.shader; - TypeEventSystem.Global.Register(OnChangeMatEvent).UnRegisterWhenGameObjectDestroyed(this); + #if VR #if Turing @@ -77,7 +76,6 @@ public class Body3DObjItem : MonoBehaviour #endif private void OnChangeMatEvent(OnChangeMat t) { - if (t.shader != null) { GetComponent().material.shader = t.shader; @@ -97,7 +95,8 @@ public class Body3DObjItem : MonoBehaviour public void Init(Body3D.Body body) { this.body = body; - + shader = GetComponent()?.material.shader; + TypeEventSystem.Global.Register(OnChangeMatEvent).UnRegisterWhenGameObjectDestroyed(this); if (body.subBody == null || body.subBody.Count == 0) { if (body.toggle != null)