{"record":{"id":"9b93127e075904a4","repo":"Unity-Technologies/UnityCsReference","slug":"check-the-connected-players-list-instead","errorCode":null,"errorMessage":"Check the connected players list instead","messagePattern":"Check the connected players list instead","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"Editor/Mono/EditorConnectionInternal.bindings.cs","lineNumber":68,"sourceCode":"\n        void IPlayerEditorConnectionNative.UnregisterInternal(Guid messageId)\n        {\n            UnregisterInternal(messageId.ToString(\"N\"));\n        }\n\n        void IPlayerEditorConnectionNative.Initialize()\n        {\n            Initialize();\n        }\n\n        void IPlayerEditorConnectionNative.DisconnectAll()\n        {\n            DisconnectAll();\n        }\n\n        public bool IsConnected()\n        {\n            throw new NotSupportedException(\"Check the connected players list instead\");\n        }\n\n        [NativeConditional(\"ENABLE_PLAYERCONNECTION && UNITY_EDITOR\")]\n        [FreeFunction(\"EditorConnectionManaged::Get\")]\n        public extern static void Initialize();\n\n        public static void UnregisterInternal(string messageId)\n        {\n            UnregisterInternal(new GUID(messageId));\n        }\n\n        [NativeConditional(\"ENABLE_PLAYERCONNECTION && UNITY_EDITOR\")]\n        [StaticAccessor(\"EditorConnectionManaged::Get()\", StaticAccessorType.Dot)]\n        [NativeName(\"Unregister\")]\n        private extern static void UnregisterInternal(UnityEngine.GUID messageId);\n\n        public static void RegisterInternal(string messageId) { RegisterInternal(new GUID(messageId)); }\n","sourceCodeStart":50,"sourceCodeEnd":86,"githubUrl":"https://github.com/Unity-Technologies/UnityCsReference/blob/225b0fbdb57cc17d094e8056b71f8314aba56f73/Editor/Mono/EditorConnectionInternal.bindings.cs#L50-L86","documentation":"Thrown unconditionally by EditorConnectionInternal.IsConnected(). The method is intentionally a stub that always throws NotSupportedException with the message 'Check the connected players list instead' — the single-boolean IsConnected model was retired in favor of enumerating connected players (PlayerConnection.GetPlayers / the connected-player list), which distinguishes per-player state. There is no input that makes it succeed.","triggerScenarios":"Any call to EditorConnection.IsConnected() (or the PlayerConnection surface that delegates to it). It cannot return normally, so the throw is deterministic, not conditional.","commonSituations":"Porting older tutorial/sample code that checks IsConnected before sending; an API surface that exposes IsConnected for back-compat but is no longer backed.","solutions":["Replace the boolean check with the connected-player enumeration API and test for a non-empty list.","Search the codebase for IsConnected() usages and remove/replace each — there is no way to make this call succeed.","If a boolean is needed, wrap: bool anyConnected = PlayerConnection.GetPlayers().Count > 0;"],"exampleFix":"// before\nif (connection.IsConnected()) { connection.Send(kMsg, data); }\n// after\nvar players = PlayerConnection.GetPlayers();\nif (players.Count > 0) { connection.Send(kMsg, data, players[0].playerId); }","handlingStrategy":"fallback","validationCode":"// IsConnected() always throws; use the player list instead.\nbool anyConnected = PlayerConnection.GetPlayers()?.Count > 0;","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Remove all EditorConnection.IsConnected() calls — the method cannot succeed.","Migrate to the connected-player enumeration model.","Search the codebase for 'IsConnected' when upgrading editor connection code."],"tags":["editor","networking","editorconnection","deprecated","removed-api"],"backgroundTag":null,"analyzedSha":"225b0fbdb57cc17d094e8056b71f8314aba56f73","analyzedAt":"2026-08-13T19:07:19.849Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}