From 1785664947840157deacd541cba23a84091d7451 Mon Sep 17 00:00:00 2001 From: shenjianxing <”315615051@qq.com“> Date: Wed, 2 Apr 2025 17:40:35 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DVR=E9=80=82=E9=85=8D=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Custom/ActiveStateSynchronizer.cs | 24 ++++++++----------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/Assets/_Scripts/Custom/ActiveStateSynchronizer.cs b/Assets/_Scripts/Custom/ActiveStateSynchronizer.cs index 92d04fc..f19336b 100644 --- a/Assets/_Scripts/Custom/ActiveStateSynchronizer.cs +++ b/Assets/_Scripts/Custom/ActiveStateSynchronizer.cs @@ -7,7 +7,6 @@ public class ActiveStateSynchronizer : MonoBehaviour [Header("ͬ")] [Tooltip("ҪͬĿ길")] public Transform targetParent; - bool isInit = false; void Update() { if (targetParent == null) @@ -35,20 +34,18 @@ public class ActiveStateSynchronizer : MonoBehaviour { sourceChild.gameObject.SetActive(targetChild.gameObject.activeSelf); } - if (isInit == false) - { - Toggle toggle; - Button btn; - if (sourceChild.TryGetComponent(out toggle) == true) - { - toggle.onValueChanged = targetChild.GetComponent().onValueChanged; - } - else if (sourceChild.TryGetComponent