From d15534a0043139541c66a84b404bf15879e31a8b Mon Sep 17 00:00:00 2001 From: shenjianxing <”315615051@qq.com“> Date: Mon, 13 Jan 2025 08:51:44 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=A9=BA=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Scripts/Item/DeviceItem.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Assets/Scripts/Item/DeviceItem.cs b/Assets/Scripts/Item/DeviceItem.cs index 51687e3e..c1f33bc8 100644 --- a/Assets/Scripts/Item/DeviceItem.cs +++ b/Assets/Scripts/Item/DeviceItem.cs @@ -48,7 +48,15 @@ public class DeviceItem : MonoBehaviour bool.TryParse(obj[0], out isActive); if (obj.Length == 1 || (obj.Length > 1 && obj[1] == device.Name)) { - gameObject.GetComponent().enabled = isActive; + var high = gameObject.GetComponent(); + if (high != null) + { + gameObject.GetComponent().enabled = isActive; + } + else + { + Debug.LogError(device.Name + "ûи"); + } } } }