MCPcopy Create free account
hub / github.com/bigdra50/unity-cli / invoke

Method invoke

unity_cli/api/dynamic_api.py:21–40  ·  view source on GitHub ↗

Invoke a Unity public static method by reflection. Args: type_name: Fully qualified type name (e.g., "UnityEditor.AssetDatabase"). method_name: Static method name (e.g., "Refresh"). params: Ordered arguments as a JSON-serializable list. Returns:

(
        self,
        type_name: str,
        method_name: str,
        params: list[Any] | None = None,
    )

Source from the content-addressed store, hash-verified

19 self._cache = SchemaCache()
20
21 def invoke(
22 self,
23 type_name: str,
24 method_name: str,
25 params: list[Any] | None = None,
26 ) -> dict[str, Any]:
27 """Invoke a Unity public static method by reflection.
28
29 Args:
30 type_name: Fully qualified type name (e.g., "UnityEditor.AssetDatabase").
31 method_name: Static method name (e.g., "Refresh").
32 params: Ordered arguments as a JSON-serializable list.
33
34 Returns:
35 Dictionary with type, method, returnType, and result.
36 """
37 return self._conn.send_request(
38 "api-invoke",
39 {"type": type_name, "method": method_name, "params": params or []},
40 )
41
42 def schema(
43 self,

Calls 1

send_requestMethod · 0.80