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)