@akiojin/unity-mcp-server 2.40.2 → 2.40.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -0
- package/bin/unity-mcp-server +1 -1
- package/package.json +1 -1
- package/src/core/codeIndex.js +64 -15
- package/src/core/server.js +3 -34
- package/src/handlers/analysis/AnalyzeSceneContentsToolHandler.js +27 -24
- package/src/handlers/analysis/FindByComponentToolHandler.js +4 -1
- package/src/handlers/analysis/GetAnimatorStateToolHandler.js +5 -5
- package/src/handlers/analysis/GetComponentValuesToolHandler.js +4 -1
- package/src/handlers/analysis/GetGameObjectDetailsToolHandler.js +27 -24
- package/src/handlers/analysis/GetInputActionsStateToolHandler.js +5 -5
- package/src/handlers/analysis/GetObjectReferencesToolHandler.js +4 -1
- package/src/handlers/asset/AssetDatabaseManageToolHandler.js +24 -6
- package/src/handlers/asset/AssetDependencyAnalyzeToolHandler.js +21 -11
- package/src/handlers/asset/AssetImportSettingsManageToolHandler.js +7 -7
- package/src/handlers/asset/AssetMaterialCreateToolHandler.js +78 -81
- package/src/handlers/asset/AssetMaterialModifyToolHandler.js +57 -61
- package/src/handlers/asset/AssetPrefabCreateToolHandler.js +61 -64
- package/src/handlers/asset/AssetPrefabExitModeToolHandler.js +9 -13
- package/src/handlers/asset/AssetPrefabInstantiateToolHandler.js +110 -116
- package/src/handlers/asset/AssetPrefabModifyToolHandler.js +58 -58
- package/src/handlers/asset/AssetPrefabOpenToolHandler.js +7 -5
- package/src/handlers/asset/AssetPrefabSaveToolHandler.js +13 -6
- package/src/handlers/compilation/CompilationGetStateToolHandler.js +4 -3
- package/src/handlers/component/ComponentAddToolHandler.js +2 -2
- package/src/handlers/component/ComponentGetTypesToolHandler.js +17 -21
- package/src/handlers/component/ComponentListToolHandler.js +5 -3
- package/src/handlers/component/ComponentModifyToolHandler.js +3 -3
- package/src/handlers/component/ComponentRemoveToolHandler.js +2 -2
- package/src/handlers/console/ConsoleClearToolHandler.js +36 -46
- package/src/handlers/editor/EditorLayersManageToolHandler.js +7 -6
- package/src/handlers/editor/EditorTagsManageToolHandler.js +20 -11
- package/src/handlers/editor/EditorToolsManageToolHandler.js +2 -2
- package/src/handlers/editor/EditorWindowsManageToolHandler.js +6 -5
- package/src/handlers/gameobject/GameObjectCreateToolHandler.js +62 -66
- package/src/handlers/gameobject/GameObjectDeleteToolHandler.js +9 -9
- package/src/handlers/gameobject/GameObjectFindToolHandler.js +13 -11
- package/src/handlers/gameobject/GameObjectGetHierarchyToolHandler.js +22 -16
- package/src/handlers/input/InputActionAddToolHandler.js +2 -2
- package/src/handlers/input/InputActionMapCreateToolHandler.js +2 -2
- package/src/handlers/input/InputActionMapRemoveToolHandler.js +2 -2
- package/src/handlers/input/InputActionRemoveToolHandler.js +2 -2
- package/src/handlers/input/InputBindingAddToolHandler.js +2 -2
- package/src/handlers/input/InputBindingCompositeCreateToolHandler.js +2 -2
- package/src/handlers/input/InputBindingRemoveAllToolHandler.js +2 -2
- package/src/handlers/input/InputBindingRemoveToolHandler.js +2 -2
- package/src/handlers/input/InputControlSchemesManageToolHandler.js +2 -2
- package/src/handlers/package/PackageManagerToolHandler.js +41 -44
- package/src/handlers/package/RegistryConfigToolHandler.js +28 -7
- package/src/handlers/playmode/PlaymodeGetStateToolHandler.js +12 -16
- package/src/handlers/playmode/PlaymodePauseToolHandler.js +8 -12
- package/src/handlers/playmode/PlaymodeWaitForStateToolHandler.js +6 -3
- package/src/handlers/scene/GetSceneInfoToolHandler.js +11 -11
- package/src/handlers/scene/SceneCreateToolHandler.js +28 -31
- package/src/handlers/scene/SceneListToolHandler.js +21 -24
- package/src/handlers/scene/SceneLoadToolHandler.js +27 -29
- package/src/handlers/scene/SceneSaveToolHandler.js +19 -22
- package/src/handlers/screenshot/ScreenshotCaptureToolHandler.js +88 -66
- package/src/handlers/script/CodeIndexStatusToolHandler.js +4 -3
- package/src/handlers/script/CodeIndexUpdateToolHandler.js +24 -14
- package/src/handlers/script/ScriptCreateClassToolHandler.js +44 -9
- package/src/handlers/script/ScriptPackagesListToolHandler.js +91 -91
- package/src/handlers/script/ScriptRefactorRenameToolHandler.js +80 -71
- package/src/handlers/script/ScriptRemoveSymbolToolHandler.js +21 -7
- package/src/handlers/script/ScriptSearchToolHandler.js +299 -266
- package/src/handlers/script/ScriptSymbolsGetToolHandler.js +88 -79
- package/src/handlers/settings/SettingsGetToolHandler.js +28 -13
- package/src/handlers/settings/SettingsUpdateToolHandler.js +20 -6
- package/src/handlers/ui/UIClickElementToolHandler.js +87 -96
- package/src/handlers/ui/UIFindElementsToolHandler.js +45 -55
- package/src/handlers/ui/UIGetElementStateToolHandler.js +35 -43
- package/src/handlers/ui/UISetElementValueToolHandler.js +42 -49
- package/src/handlers/ui/UISimulateInputToolHandler.js +134 -136
- package/src/handlers/video/VideoCaptureForToolHandler.js +24 -7
- package/src/lsp/LspRpcClient.js +24 -12
- package/src/tools/analysis/analyzeSceneContents.js +85 -85
- package/src/tools/analysis/findByComponent.js +73 -73
- package/src/tools/analysis/getAnimatorState.js +287 -287
- package/src/tools/analysis/getComponentValues.js +161 -161
- package/src/tools/analysis/getGameObjectDetails.js +138 -138
- package/src/tools/analysis/getInputActionsState.js +291 -291
- package/src/tools/analysis/getObjectReferences.js +72 -72
- package/src/tools/input/inputActionsEditor.js +522 -474
- package/src/tools/scene/createScene.js +98 -97
- package/src/tools/scene/getSceneInfo.js +82 -81
- package/src/tools/scene/listScenes.js +70 -69
- package/src/tools/scene/loadScene.js +108 -106
- package/src/tools/scene/saveScene.js +78 -77
- package/src/tools/system/ping.js +9 -12
- package/src/utils/validators.js +2 -2
|
@@ -1,326 +1,326 @@
|
|
|
1
1
|
// Tool definition for analysis_animator_state_get
|
|
2
2
|
export const getAnimatorStateToolDefinition = {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
3
|
+
name: 'analysis_animator_state_get',
|
|
4
|
+
description: 'Get Animator state: layers, transitions, and parameter values for a GameObject.',
|
|
5
|
+
inputSchema: {
|
|
6
|
+
type: 'object',
|
|
7
|
+
properties: {
|
|
8
|
+
gameObjectName: {
|
|
9
|
+
type: 'string',
|
|
10
|
+
description: 'Name of the GameObject with the Animator component'
|
|
11
|
+
},
|
|
12
|
+
includeParameters: {
|
|
13
|
+
type: 'boolean',
|
|
14
|
+
description: 'Include all animator parameters and their current values. Default: true',
|
|
15
|
+
default: true
|
|
16
|
+
},
|
|
17
|
+
includeStates: {
|
|
18
|
+
type: 'boolean',
|
|
19
|
+
description: 'Include current state information for each layer. Default: true',
|
|
20
|
+
default: true
|
|
21
|
+
},
|
|
22
|
+
includeTransitions: {
|
|
23
|
+
type: 'boolean',
|
|
24
|
+
description: 'Include active transition information. Default: true',
|
|
25
|
+
default: true
|
|
26
|
+
},
|
|
27
|
+
includeClips: {
|
|
28
|
+
type: 'boolean',
|
|
29
|
+
description: 'Include animation clip information. Default: false',
|
|
30
|
+
default: false
|
|
31
|
+
},
|
|
32
|
+
layerIndex: {
|
|
33
|
+
type: 'number',
|
|
34
|
+
description: 'Specific layer index to query (-1 for all layers). Default: -1',
|
|
35
|
+
default: -1
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
required: ['gameObjectName']
|
|
39
|
+
}
|
|
40
40
|
};
|
|
41
41
|
|
|
42
42
|
// Tool definition for analysis_animator_runtime_info_get
|
|
43
43
|
export const getAnimatorRuntimeInfoToolDefinition = {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
44
|
+
name: 'analysis_animator_runtime_info_get',
|
|
45
|
+
description: 'Get Animator runtime info (IK, root motion, performance) — Play mode only.',
|
|
46
|
+
inputSchema: {
|
|
47
|
+
type: 'object',
|
|
48
|
+
properties: {
|
|
49
|
+
gameObjectName: {
|
|
50
|
+
type: 'string',
|
|
51
|
+
description: 'Name of the GameObject with the Animator component'
|
|
52
|
+
},
|
|
53
|
+
includeIK: {
|
|
54
|
+
type: 'boolean',
|
|
55
|
+
description: 'Include IK (Inverse Kinematics) information. Default: true',
|
|
56
|
+
default: true
|
|
57
|
+
},
|
|
58
|
+
includeRootMotion: {
|
|
59
|
+
type: 'boolean',
|
|
60
|
+
description: 'Include root motion information. Default: true',
|
|
61
|
+
default: true
|
|
62
|
+
},
|
|
63
|
+
includeBehaviours: {
|
|
64
|
+
type: 'boolean',
|
|
65
|
+
description: 'Include state machine behaviours. Default: false',
|
|
66
|
+
default: false
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
required: ['gameObjectName']
|
|
70
|
+
}
|
|
71
71
|
};
|
|
72
72
|
|
|
73
73
|
// Handler for get_animator_state
|
|
74
74
|
export async function getAnimatorStateHandler(unityConnection, args) {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
75
|
+
try {
|
|
76
|
+
// Check connection
|
|
77
|
+
if (!unityConnection.isConnected()) {
|
|
78
|
+
return {
|
|
79
|
+
content: [
|
|
80
|
+
{
|
|
81
|
+
type: 'text',
|
|
82
|
+
text: 'Failed to get animator state: Unity connection not available'
|
|
83
|
+
}
|
|
84
|
+
],
|
|
85
|
+
isError: true
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
88
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
89
|
+
// Validate required parameters
|
|
90
|
+
if (!args.gameObjectName) {
|
|
91
|
+
return {
|
|
92
|
+
content: [
|
|
93
|
+
{
|
|
94
|
+
type: 'text',
|
|
95
|
+
text: 'Failed to get animator state: gameObjectName is required'
|
|
96
|
+
}
|
|
97
|
+
],
|
|
98
|
+
isError: true
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
101
|
|
|
102
|
-
|
|
103
|
-
|
|
102
|
+
// Send command to Unity
|
|
103
|
+
const result = await unityConnection.sendCommand('analysis_animator_state_get', args);
|
|
104
104
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
105
|
+
// Check for errors
|
|
106
|
+
if (!result || typeof result === 'string') {
|
|
107
|
+
return {
|
|
108
|
+
content: [
|
|
109
|
+
{
|
|
110
|
+
type: 'text',
|
|
111
|
+
text: `Failed to get animator state: Invalid response format`
|
|
112
|
+
}
|
|
113
|
+
],
|
|
114
|
+
isError: true
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
117
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
118
|
+
if (result.error) {
|
|
119
|
+
return {
|
|
120
|
+
content: [
|
|
121
|
+
{
|
|
122
|
+
type: 'text',
|
|
123
|
+
text: `Failed to get animator state: ${result.error}`
|
|
124
|
+
}
|
|
125
|
+
],
|
|
126
|
+
isError: true
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
129
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
130
|
+
// Format the response
|
|
131
|
+
let text = result.summary || `Animator state retrieved for '${args.gameObjectName}'`;
|
|
132
|
+
|
|
133
|
+
if (result.controllerName) {
|
|
134
|
+
text += `\nController: ${result.controllerName}`;
|
|
135
|
+
}
|
|
136
136
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
if (layer.currentState) {
|
|
144
|
-
text += `\n- Current State: ${layer.currentState.name || `Hash: ${layer.currentState.fullPathHash}`}`;
|
|
145
|
-
text += `\n - Normalized Time: ${layer.currentState.normalizedTime?.toFixed(3)}`;
|
|
146
|
-
text += `\n - Speed: ${layer.currentState.speed}`;
|
|
147
|
-
if (layer.currentState.motion) {
|
|
148
|
-
text += `\n - Motion: ${layer.currentState.motion}`;
|
|
149
|
-
}
|
|
150
|
-
}
|
|
137
|
+
if (result.layers && Array.isArray(result.layers)) {
|
|
138
|
+
text += `\n\n## Layer States:`;
|
|
139
|
+
result.layers.forEach(layer => {
|
|
140
|
+
text += `\n\n### Layer ${layer.layerIndex}: ${layer.layerName || 'Base Layer'}`;
|
|
141
|
+
text += `\n- Weight: ${layer.layerWeight}`;
|
|
151
142
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
}
|
|
160
|
-
});
|
|
143
|
+
if (layer.currentState) {
|
|
144
|
+
text += `\n- Current State: ${layer.currentState.name || `Hash: ${layer.currentState.fullPathHash}`}`;
|
|
145
|
+
text += `\n - Normalized Time: ${layer.currentState.normalizedTime?.toFixed(3)}`;
|
|
146
|
+
text += `\n - Speed: ${layer.currentState.speed}`;
|
|
147
|
+
if (layer.currentState.motion) {
|
|
148
|
+
text += `\n - Motion: ${layer.currentState.motion}`;
|
|
149
|
+
}
|
|
161
150
|
}
|
|
162
151
|
|
|
163
|
-
if (
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
}
|
|
152
|
+
if (layer.activeTransition) {
|
|
153
|
+
text += `\n- Active Transition:`;
|
|
154
|
+
text += `\n - Duration: ${layer.activeTransition.duration}`;
|
|
155
|
+
text += `\n - Progress: ${(layer.activeTransition.normalizedTime * 100).toFixed(1)}%`;
|
|
156
|
+
if (layer.activeTransition.nextState) {
|
|
157
|
+
text += `\n - To: ${layer.activeTransition.nextState.name || 'Unknown'}`;
|
|
158
|
+
}
|
|
171
159
|
}
|
|
160
|
+
});
|
|
161
|
+
}
|
|
172
162
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
};
|
|
182
|
-
} catch (error) {
|
|
183
|
-
return {
|
|
184
|
-
content: [
|
|
185
|
-
{
|
|
186
|
-
type: 'text',
|
|
187
|
-
text: `Failed to get animator state: ${error.message}`
|
|
188
|
-
}
|
|
189
|
-
],
|
|
190
|
-
isError: true
|
|
191
|
-
};
|
|
163
|
+
if (result.parameters && Object.keys(result.parameters).length > 0) {
|
|
164
|
+
text += `\n\n## Parameters:`;
|
|
165
|
+
for (const [name, param] of Object.entries(result.parameters)) {
|
|
166
|
+
text += `\n- ${name} (${param.type}): ${param.value}`;
|
|
167
|
+
if (param.defaultValue !== undefined && param.type !== 'Trigger') {
|
|
168
|
+
text += ` [default: ${param.defaultValue}]`;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
192
171
|
}
|
|
172
|
+
|
|
173
|
+
return {
|
|
174
|
+
content: [
|
|
175
|
+
{
|
|
176
|
+
type: 'text',
|
|
177
|
+
text: text
|
|
178
|
+
}
|
|
179
|
+
],
|
|
180
|
+
isError: false
|
|
181
|
+
};
|
|
182
|
+
} catch (error) {
|
|
183
|
+
return {
|
|
184
|
+
content: [
|
|
185
|
+
{
|
|
186
|
+
type: 'text',
|
|
187
|
+
text: `Failed to get animator state: ${error.message}`
|
|
188
|
+
}
|
|
189
|
+
],
|
|
190
|
+
isError: true
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
193
|
}
|
|
194
194
|
|
|
195
195
|
// Handler for get_animator_runtime_info
|
|
196
196
|
export async function getAnimatorRuntimeInfoHandler(unityConnection, args) {
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
197
|
+
try {
|
|
198
|
+
// Check connection
|
|
199
|
+
if (!unityConnection.isConnected()) {
|
|
200
|
+
return {
|
|
201
|
+
content: [
|
|
202
|
+
{
|
|
203
|
+
type: 'text',
|
|
204
|
+
text: 'Failed to get animator runtime info: Unity connection not available'
|
|
205
|
+
}
|
|
206
|
+
],
|
|
207
|
+
isError: true
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
210
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
211
|
+
// Validate required parameters
|
|
212
|
+
if (!args.gameObjectName) {
|
|
213
|
+
return {
|
|
214
|
+
content: [
|
|
215
|
+
{
|
|
216
|
+
type: 'text',
|
|
217
|
+
text: 'Failed to get animator runtime info: gameObjectName is required'
|
|
218
|
+
}
|
|
219
|
+
],
|
|
220
|
+
isError: true
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
223
|
|
|
224
|
-
|
|
225
|
-
|
|
224
|
+
// Send command to Unity
|
|
225
|
+
const result = await unityConnection.sendCommand('analysis_animator_runtime_info_get', args);
|
|
226
226
|
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
227
|
+
// Check for errors
|
|
228
|
+
if (!result || typeof result === 'string') {
|
|
229
|
+
return {
|
|
230
|
+
content: [
|
|
231
|
+
{
|
|
232
|
+
type: 'text',
|
|
233
|
+
text: `Failed to get animator runtime info: Invalid response format`
|
|
234
|
+
}
|
|
235
|
+
],
|
|
236
|
+
isError: true
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
239
|
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
240
|
+
if (result.error) {
|
|
241
|
+
return {
|
|
242
|
+
content: [
|
|
243
|
+
{
|
|
244
|
+
type: 'text',
|
|
245
|
+
text: `Failed to get animator runtime info: ${result.error}`
|
|
246
|
+
}
|
|
247
|
+
],
|
|
248
|
+
isError: true
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
251
|
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
text += `\n\n## General Info:`;
|
|
256
|
-
text += `\n- Controller: ${result.runtimeAnimatorController || 'None'}`;
|
|
257
|
-
text += `\n- Update Mode: ${result.updateMode}`;
|
|
258
|
-
text += `\n- Culling Mode: ${result.cullingMode}`;
|
|
259
|
-
text += `\n- Speed: ${result.speed}`;
|
|
260
|
-
text += `\n- Playback Time: ${result.playbackTime?.toFixed(3)}`;
|
|
252
|
+
// Format the response
|
|
253
|
+
let text = result.summary || `Animator runtime info retrieved for '${args.gameObjectName}'`;
|
|
261
254
|
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
255
|
+
text += `\n\n## General Info:`;
|
|
256
|
+
text += `\n- Controller: ${result.runtimeAnimatorController || 'None'}`;
|
|
257
|
+
text += `\n- Update Mode: ${result.updateMode}`;
|
|
258
|
+
text += `\n- Culling Mode: ${result.cullingMode}`;
|
|
259
|
+
text += `\n- Speed: ${result.speed}`;
|
|
260
|
+
text += `\n- Playback Time: ${result.playbackTime?.toFixed(3)}`;
|
|
268
261
|
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
}
|
|
262
|
+
if (result.avatar) {
|
|
263
|
+
text += `\n\n## Avatar:`;
|
|
264
|
+
text += `\n- Name: ${result.avatar.name}`;
|
|
265
|
+
text += `\n- Valid: ${result.avatar.isValid}`;
|
|
266
|
+
text += `\n- Human: ${result.avatar.isHuman}`;
|
|
267
|
+
}
|
|
276
268
|
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
text += `\n\n### IK Goals:`;
|
|
285
|
-
for (const [goal, data] of Object.entries(result.ikInfo.goals)) {
|
|
286
|
-
text += `\n- ${goal}:`;
|
|
287
|
-
text += `\n - Position Weight: ${data.positionWeight}`;
|
|
288
|
-
text += `\n - Rotation Weight: ${data.rotationWeight}`;
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
}
|
|
269
|
+
if (result.rootMotion) {
|
|
270
|
+
text += `\n\n## Root Motion:`;
|
|
271
|
+
text += `\n- Apply Root Motion: ${result.rootMotion.applyRootMotion}`;
|
|
272
|
+
text += `\n- Has Root Motion: ${result.rootMotion.hasRootMotion}`;
|
|
273
|
+
text += `\n- Velocity: (${result.rootMotion.velocity.x?.toFixed(2)}, ${result.rootMotion.velocity.y?.toFixed(2)}, ${result.rootMotion.velocity.z?.toFixed(2)})`;
|
|
274
|
+
text += `\n- Angular Velocity: (${result.rootMotion.angularVelocity.x?.toFixed(2)}, ${result.rootMotion.angularVelocity.y?.toFixed(2)}, ${result.rootMotion.angularVelocity.z?.toFixed(2)})`;
|
|
275
|
+
}
|
|
292
276
|
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
}
|
|
277
|
+
if (result.ikInfo) {
|
|
278
|
+
text += `\n\n## IK Info:`;
|
|
279
|
+
text += `\n- Human Scale: ${result.ikInfo.humanScale}`;
|
|
280
|
+
text += `\n- Feet Pivot Active: ${result.ikInfo.feetPivotActive}`;
|
|
281
|
+
text += `\n- Pivot Weight: ${result.ikInfo.pivotWeight}`;
|
|
299
282
|
|
|
300
|
-
|
|
301
|
-
text += `\n
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
283
|
+
if (result.ikInfo.goals) {
|
|
284
|
+
text += `\n\n### IK Goals:`;
|
|
285
|
+
for (const [goal, data] of Object.entries(result.ikInfo.goals)) {
|
|
286
|
+
text += `\n- ${goal}:`;
|
|
287
|
+
text += `\n - Position Weight: ${data.positionWeight}`;
|
|
288
|
+
text += `\n - Rotation Weight: ${data.rotationWeight}`;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
}
|
|
305
292
|
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
}
|
|
312
|
-
],
|
|
313
|
-
isError: false
|
|
314
|
-
};
|
|
315
|
-
} catch (error) {
|
|
316
|
-
return {
|
|
317
|
-
content: [
|
|
318
|
-
{
|
|
319
|
-
type: 'text',
|
|
320
|
-
text: `Failed to get animator runtime info: ${error.message}`
|
|
321
|
-
}
|
|
322
|
-
],
|
|
323
|
-
isError: true
|
|
324
|
-
};
|
|
293
|
+
if (result.behaviours && result.behaviours.length > 0) {
|
|
294
|
+
text += `\n\n## State Machine Behaviours:`;
|
|
295
|
+
result.behaviours.forEach(behaviour => {
|
|
296
|
+
text += `\n- Layer ${behaviour.layer}: ${behaviour.type} (${behaviour.enabled ? 'Enabled' : 'Disabled'})`;
|
|
297
|
+
});
|
|
325
298
|
}
|
|
299
|
+
|
|
300
|
+
text += `\n\n## Performance:`;
|
|
301
|
+
text += `\n- Has Bound Playables: ${result.hasBoundPlayables}`;
|
|
302
|
+
text += `\n- Has Transform Hierarchy: ${result.hasTransformHierarchy}`;
|
|
303
|
+
text += `\n- Is Optimizable: ${result.isOptimizable}`;
|
|
304
|
+
text += `\n- Gravity Weight: ${result.gravityWeight}`;
|
|
305
|
+
|
|
306
|
+
return {
|
|
307
|
+
content: [
|
|
308
|
+
{
|
|
309
|
+
type: 'text',
|
|
310
|
+
text: text
|
|
311
|
+
}
|
|
312
|
+
],
|
|
313
|
+
isError: false
|
|
314
|
+
};
|
|
315
|
+
} catch (error) {
|
|
316
|
+
return {
|
|
317
|
+
content: [
|
|
318
|
+
{
|
|
319
|
+
type: 'text',
|
|
320
|
+
text: `Failed to get animator runtime info: ${error.message}`
|
|
321
|
+
}
|
|
322
|
+
],
|
|
323
|
+
isError: true
|
|
324
|
+
};
|
|
325
|
+
}
|
|
326
326
|
}
|