Class ManageAsset
Handles asset management operations within the Unity project.
Inherited Members
Namespace: Unity.AI.MCP.Editor.Tools
Assembly: Unity.AI.MCP.Editor.dll
Syntax
public static class ManageAsset
Fields
Description
Human-readable description of the Unity.ManageAsset tool functionality and usage.
Declaration
public const string Description = "Performs asset operations (import, create, modify, delete, etc.) in Unity.\n\nArgs:\n Action: Operation to perform (e.g., 'Import', 'Create', 'Modify', 'Delete', 'Duplicate', 'Move', 'Rename', 'Search', 'GetInfo', 'CreateFolder', 'GetComponents').\n Path: Asset path (e.g., \"Assets/Materials/MyMaterial.mat\") or search scope.\n AssetType: Asset type (e.g., 'Material', 'Folder') - required for 'create'.\n Properties: Dictionary of properties for 'create'/'modify'.\n example properties for Material: {\"color\": [1, 0, 0, 1], \"shader\": \"Standard\"}.\n example properties for Texture: {\"width\": 1024, \"height\": 1024, \"format\": \"RGBA32\"}.\n example properties for PhysicsMaterial: {\"bounciness\": 1.0, \"staticFriction\": 0.5, \"dynamicFriction\": 0.5}.\n Destination: Target path for 'duplicate'/'move'.\n SearchPattern: Search pattern (e.g., '*.prefab').\n Filter*: Filters for search (Type, Date).\n Page: Pagination for search.\n\nReturns:\n A dictionary with operation results ('success', 'data', 'error')."
Field Value
| Type | Description |
|---|---|
| string |
Methods
AssetPathExists(string)
Checks if an asset exists at the specified path.
Declaration
public static bool AssetPathExists(string assetPath)
Parameters
| Type | Name | Description |
|---|---|---|
| string | assetPath | The asset path to check. |
Returns
| Type | Description |
|---|---|
| bool | True if the asset exists; otherwise, false. |
HandleCommand(ManageAssetParams)
Demonstrates typed parameter handling with automatic schema generation. The schema is auto-generated from the ManageAssetParams record type.
Declaration
[McpTool("Unity.ManageAsset", "Performs asset operations (import, create, modify, delete, etc.) in Unity.\n\nArgs:\n Action: Operation to perform (e.g., 'Import', 'Create', 'Modify', 'Delete', 'Duplicate', 'Move', 'Rename', 'Search', 'GetInfo', 'CreateFolder', 'GetComponents').\n Path: Asset path (e.g., \"Assets/Materials/MyMaterial.mat\") or search scope.\n AssetType: Asset type (e.g., 'Material', 'Folder') - required for 'create'.\n Properties: Dictionary of properties for 'create'/'modify'.\n example properties for Material: {\"color\": [1, 0, 0, 1], \"shader\": \"Standard\"}.\n example properties for Texture: {\"width\": 1024, \"height\": 1024, \"format\": \"RGBA32\"}.\n example properties for PhysicsMaterial: {\"bounciness\": 1.0, \"staticFriction\": 0.5, \"dynamicFriction\": 0.5}.\n Destination: Target path for 'duplicate'/'move'.\n SearchPattern: Search pattern (e.g., '*.prefab').\n Filter*: Filters for search (Type, Date).\n Page: Pagination for search.\n\nReturns:\n A dictionary with operation results ('success', 'data', 'error').", null, null, Groups = new string[] { "core", "assets" })]
public static object HandleCommand(ManageAssetParams @params)
Parameters
| Type | Name | Description |
|---|---|---|
| ManageAssetParams | params | Parameters containing the action to perform and relevant asset information. |
Returns
| Type | Description |
|---|---|
| object | A response object indicating success or failure with relevant asset data. |