-
Notifications
You must be signed in to change notification settings - Fork 660
Description
Description
After PR #375 was merged, the MCP setup dialog appears every time Unity is launched, even after completing the setup process. The setup completion state is not being persisted to EditorPrefs.
Root Cause
The MCPSetupWindow.OnDoneClicked() method closes the window without calling SetupWindowService.MarkSetupCompleted():
private void OnDoneClicked()
{
Close(); // ❌ Does not save completion flag
}This causes SetupWindowService.CheckSetupNeeded() to find no completion flag on every Unity startup, triggering the setup dialog repeatedly.
Expected Behavior
After clicking "Done" in the setup window, the completion state should be saved to EditorPrefs (MCPForUnity.SetupCompleted), and the setup dialog should not appear on subsequent Unity launches.
Actual Behavior
The setup dialog appears every time Unity is launched, regardless of how many times the user clicks "Done".
Evidence
- Missing call:
OnDoneClicked()does not callSetupWindowService.MarkSetupCompleted() - Setup check logic:
SetupWindowService.CheckSetupNeeded()(lines 51-55) correctly checks for the flag:
bool setupCompleted = EditorPrefs.GetBool(SETUP_COMPLETED_KEY, false);
bool setupDismissed = EditorPrefs.GetBool(SETUP_DISMISSED_KEY, false);
if (!(setupCompleted || setupDismissed)) {
// Show setup window
}- No code path saves the flag: There is no code path that calls
MarkSetupCompleted()when the user completes setup
Additional Context
Some team members who had the package installed before PR #375 reported that the dialog does not appear for them. This is because the old implementation saved the completion flag, and EditorPrefs persists across package updates.
Suggested Fix
Change OnDoneClicked() to:
private void OnDoneClicked()
{
Setup.SetupWindowService.MarkSetupCompleted();
Close();
}Environment
- Unity MCP Version: v8.7.1 (and all versions since PR HTTP Server, uvx, C# only custom tools #375)
- Unity Version: 6000.0.59f2 (but affects all Unity versions)
Steps to Reproduce
- Install Unity MCP for the first time (or clear EditorPrefs key
MCPForUnity.SetupCompleted) - Launch Unity
- Complete the setup dialog by clicking "Done"
- Close Unity
- Launch Unity again
- Bug: Setup dialog appears again