List all connected Unity instances. Returns: List of instance info dictionaries with keys: - instance_id: Project path - project_name: Project name - unity_version: Unity version - status: Connection status - is_default
(self)
| 449 | sock.close() |
| 450 | |
| 451 | def list_instances(self) -> list[dict[str, Any]]: |
| 452 | """List all connected Unity instances. |
| 453 | |
| 454 | Returns: |
| 455 | List of instance info dictionaries with keys: |
| 456 | - instance_id: Project path |
| 457 | - project_name: Project name |
| 458 | - unity_version: Unity version |
| 459 | - status: Connection status |
| 460 | - is_default: Whether this is the default instance |
| 461 | """ |
| 462 | message = { |
| 463 | "type": "LIST_INSTANCES", |
| 464 | "id": _generate_request_id(self._client_id), |
| 465 | "ts": int(time.time() * 1000), |
| 466 | } |
| 467 | |
| 468 | response = self._send_admin_message(message) |
| 469 | |
| 470 | if response.get("type") == "INSTANCES": |
| 471 | data: dict[str, Any] = response.get("data", {}) |
| 472 | instances: list[dict[str, Any]] = data.get("instances", []) |
| 473 | return instances |
| 474 | |
| 475 | raise ProtocolError( |
| 476 | f"Unexpected response type: {response.get('type')}", |
| 477 | "PROTOCOL_ERROR", |
| 478 | ) |
| 479 | |
| 480 | def set_default_instance(self, instance_id: str) -> bool: |
| 481 | """Set the default Unity instance. |
nothing calls this directly
no test coverage detected