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