manage_scriptable_object
Auto-generated from the Python tool registry. Do not hand-edit outside
<!-- examples:start --><!-- examples:end -->blocks — the generator (tools/generate_docs_reference.py) will overwrite them.
Group: scripting_ext · Module: services.tools.manage_scriptable_object
Maturity: stable (support status; independent of enabled state, readiness and permissions).
Description
Creates and modifies ScriptableObject assets using Unity SerializedObject property paths. Patches are ordered best_effort: each result preserves its request index, ok and applied/failed/skipped status; successful earlier patches remain and later ones are attempted. A skipped successful patch left serialized values unchanged. Legacy top-level success is unchanged; inspect individual results. dry_run validates without applying; arbitrary SO callbacks do not have an atomic rollback contract.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
action | Literal['create', 'modify'] | yes | Action to perform: create or modify. |
type_name | str | None | — | Namespace-qualified ScriptableObject type name (for create). |
folder_path | str | None | — | Target folder under Assets/... (for create). |
asset_name | str | None | — | Asset file name without extension (for create). |
overwrite | bool | str | None | — | If true, overwrite existing asset at same path (for create). |
target | dict[str, Any] | str | None | — | Target asset reference {guid|path} (for modify). |
patches | list[dict[str, Any]] | str | None | — | Patch list (or JSON string) to apply. For object references: use {"ref": {"guid": "..."}} or {"value": {"guid": "..."}}. For Sprite sub-assets: include "spriteName" in the ref/value object. Single-sprite textures auto-resolve from guid/path alone. Unity preflights growth: 1,048,576 elements per growing array and 2,097,152 added serialized elements/fields per request, including nested copies. |
dry_run | bool | str | None | — | If true, validate patches without applying (modify only). |
unity_instance | str | int | None | — | Target Unity instance for this call: Name@hash or hash prefix; an integer selects only that exact port over stdio and is rejected over HTTP. Read mcpforunity://instances for available targets. Omit to use the legacy active selection or the sole available instance. |
Returns
A dict containing the Unity response. The exact shape depends on the action.
Examples
Validate a change to an integer property before applying it. Replace the path with your existing tuning asset and maxLives with its canonical serialized field path. dry_run checks the patch without applying it.
{
"action": "modify",
"target": {
"path": "Assets/Config/GameTuning.asset"
},
"patches": [
{
"path": "maxLives",
"value": 5
}
],
"dry_run": true
}