diff --git a/Samples~/WebsocketDemo/WebSocketBindings.cs b/Samples~/WebsocketDemo/WebSocketBindings.cs index a78d236..7d311ad 100644 --- a/Samples~/WebsocketDemo/WebSocketBindings.cs +++ b/Samples~/WebsocketDemo/WebSocketBindings.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; using System.Text; +using System.Threading; using UnityEngine; using UnityEngine.UIElements; @@ -44,6 +45,11 @@ public class WebSocketBindings : MonoBehaviour private WebSocket webSocket; private readonly List> logs = new(); +#if !UNITY_2022_3_OR_NEWER + // ReSharper disable once InconsistentNaming + private CancellationToken destroyCancellationToken => destroyCancellationTokenSource.Token; + private CancellationTokenSource destroyCancellationTokenSource = new CancellationTokenSource(); +#endif private void OnValidate() { @@ -58,7 +64,6 @@ private void Awake() OnValidate(); var root = uiDocument.rootVisualElement; - statusLabel = root.Q