Skip to content

Setup dialog appears on every Unity startup despite completion (since PR #375) #523

@khattori1018

Description

@khattori1018

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

  1. Missing call: OnDoneClicked() does not call SetupWindowService.MarkSetupCompleted()
  2. 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
}
  1. 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

Steps to Reproduce

  1. Install Unity MCP for the first time (or clear EditorPrefs key MCPForUnity.SetupCompleted)
  2. Launch Unity
  3. Complete the setup dialog by clicking "Done"
  4. Close Unity
  5. Launch Unity again
  6. Bug: Setup dialog appears again

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions