AgentSkillsCN

unity-console

捕获并管理Unity控制台日志。

SKILL.md
--- frontmatter
name: unity-console
description: "Capture and manage Unity console logs."

Unity Console Skills

Work with the Unity console - capture logs, write messages, and debug your project.

Skills Overview

SkillDescription
console_start_captureStart capturing logs
console_stop_captureStop capturing logs
console_get_logsGet captured logs
console_clearClear console
console_logWrite log message

Skills

console_start_capture

Start capturing Unity console logs.

No parameters.

console_stop_capture

Stop capturing logs.

No parameters.

console_get_logs

Get captured logs with optional filtering.

ParameterTypeRequiredDefaultDescription
filterstringNonullLog/Warning/Error
limitintNo100Max results

Returns: {success, totalLogs, logs: [{type, message, timestamp}]}

console_clear

Clear the Unity console.

No parameters.

console_log

Write a custom log message.

ParameterTypeRequiredDefaultDescription
messagestringYes-Log message
typestringNo"Log"Log/Warning/Error

Example Usage

python
import unity_skills

# Start capturing logs before play mode
unity_skills.call_skill("console_start_capture")

# Enter play mode
unity_skills.call_skill("editor_play")
# ... gameplay generates logs ...
unity_skills.call_skill("editor_stop")

# Get all captured logs
logs = unity_skills.call_skill("console_get_logs")
for log in logs['logs']:
    print(f"[{log['type']}] {log['message']}")

# Get only errors
errors = unity_skills.call_skill("console_get_logs", filter="Error")
if errors['totalLogs'] > 0:
    print(f"Found {errors['totalLogs']} errors!")

# Write custom log
unity_skills.call_skill("console_log",
    message="AI Agent: Task completed",
    type="Log"
)

# Write warning
unity_skills.call_skill("console_log",
    message="AI Agent: Performance issue detected",
    type="Warning"
)

# Clear and stop
unity_skills.call_skill("console_clear")
unity_skills.call_skill("console_stop_capture")

Best Practices

  1. Start capture before play mode for runtime logs
  2. Filter by Error to quickly find problems
  3. Use custom logs to mark AI agent actions
  4. Clear console before starting new capture session
  5. Stop capture when done to free resources