Optimise so startup is fast again#494
Conversation
We lazy load tools, remove the expensive AssetPath property, and reflect for only `McpForUnityToolAttribute`, so it's much faster. A 6 second startup is now back to 400ms. Can still be optimised but this is good
The tests automatically cleans this up, so it likely got pushed by accident
📝 WalkthroughWalkthroughChanges refactor tool discovery to use TypeCache instead of assembly scanning, eliminate AssetPath property and related caching infrastructure, simplify built-in tool detection, and introduce lazy loading for the Tools UI panel to improve startup performance. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
📜 Recent review detailsConfiguration used: defaults Review profile: CHILL Plan: Pro 📒 Files selected for processing (4)
💤 Files with no reviewable changes (2)
🧰 Additional context used🧠 Learnings (4)📚 Learning: 2025-12-29T15:23:11.613ZApplied to files:
📚 Learning: 2025-09-03T16:00:55.839ZApplied to files:
📚 Learning: 2025-10-13T13:27:23.040ZApplied to files:
📚 Learning: 2025-10-13T13:41:00.086ZApplied to files:
🧬 Code graph analysis (2)MCPForUnity/Editor/Windows/MCPForUnityEditorWindow.cs (1)
MCPForUnity/Editor/Services/ToolDiscoveryService.cs (1)
🔇 Additional comments (8)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
👏👏👏 |
|
Did some testing, I think users will appreciate this one! |
This PR does a few things:
McpForUnityToolattribute via reflectionMCPForUnity.Editor.Toolsinstead of checking the asset path, which took a whileStartup time went from 6-12 seconds to around 200-500ms.
Summary by CodeRabbit
Release Notes
Refactor
Chores
✏️ Tip: You can customize this high-level summary in your review settings.