diff --git a/Assets/Mirror/Examples/MultipleMatches/Prefabs/MatchGUI.prefab b/Assets/Mirror/Examples/MultipleMatches/Prefabs/MatchGUI.prefab index bb96954d2..ef84e0f1e 100644 --- a/Assets/Mirror/Examples/MultipleMatches/Prefabs/MatchGUI.prefab +++ b/Assets/Mirror/Examples/MultipleMatches/Prefabs/MatchGUI.prefab @@ -206,7 +206,19 @@ MonoBehaviour: m_Group: {fileID: 0} onValueChanged: m_PersistentCalls: - m_Calls: [] + m_Calls: + - m_Target: {fileID: 114572912279416540} + m_TargetAssemblyTypeName: Mirror.Examples.MultipleMatch.MatchGUI, Mirror.Examples + m_MethodName: OnToggleClicked + m_Mode: 0 + m_Arguments: + m_ObjectArgument: {fileID: 0} + m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine + m_IntArgument: 0 + m_FloatArgument: 0 + m_StringArgument: + m_BoolArgument: 0 + m_CallState: 2 m_IsOn: 0 --- !u!114 &114572912279416540 MonoBehaviour: diff --git a/Assets/Mirror/Examples/MultipleMatches/Scripts/MatchGUI.cs b/Assets/Mirror/Examples/MultipleMatches/Scripts/MatchGUI.cs index 74c0b1c85..f378ca535 100644 --- a/Assets/Mirror/Examples/MultipleMatches/Scripts/MatchGUI.cs +++ b/Assets/Mirror/Examples/MultipleMatches/Scripts/MatchGUI.cs @@ -1,4 +1,4 @@ -using System; +using System; using UnityEngine; using UnityEngine.UI; @@ -25,14 +25,13 @@ public void Awake() // Deprecated in Unity 2023.1 canvasController = GameObject.FindObjectOfType(); #endif - toggleButton.onValueChanged.AddListener(delegate { OnToggleClicked(); }); } [ClientCallback] - public void OnToggleClicked() + public void OnToggleClicked(bool isOn) { - canvasController.SelectMatch(toggleButton.isOn ? matchId : Guid.Empty); - image.color = toggleButton.isOn ? new Color(0f, 1f, 0f, 0.5f) : new Color(1f, 1f, 1f, 0.2f); + canvasController.SelectMatch(isOn ? matchId : Guid.Empty); + image.color = isOn ? new Color(0f, 1f, 0f, 0.5f) : new Color(1f, 1f, 1f, 0.2f); } [ClientCallback]