Skip to content

Unity console keeps logging warning message: "Error communicating with Python server: The operation is not allowed on non-connected sockets." #48

@lingllting

Description

@lingllting

The Unity MCP Editor Window has a periodic check (every 2 seconds) that tries to verify the Python server connection:

if (Time.realtimeSinceStartup - lastCheckTime >= CONNECTION_CHECK_INTERVAL) // CONNECTION_CHECK_INTERVAL = 2f
{
    CheckPythonServerConnection();
    lastCheckTime = Time.realtimeSinceStartup;
}

This check tries to:
Connect to localhost:6400
Send a "ping" message
Wait for a "pong" response

The issue is that this check is using a different connection mechanism than the actual MCP commands. When you create objects or perform other actions, those go through the established MCP connection, but this status check creates a new TCP connection each time.
The error messages come from these periodic checks failing to establish new connections, even though the main MCP connection (used for actual commands) is working fine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions