/*
┌──────────────────────────────────────────────────────────────────┐
│ Author: Ivan Murzak (https://github.com/IvanMurzak) │
│ Repository: GitHub (https://github.com/IvanMurzak/Unity-MCP) │
│ Copyright (c) 2025 Ivan Murzak │
│ Licensed under the Apache License, Version 2.0. │
│ See the LICENSE file in the project root for more information. │
└──────────────────────────────────────────────────────────────────┘
*/
#nullable enable
using UnityEditor;
using UnityEngine;
namespace com.IvanMurzak.Unity.MCP.Editor.Utils
{
///
/// Team-shared settings for the Unity-MCP update checker, persisted under
/// ProjectSettings/AI-Game-Developer-UpdateSettings.asset.
///
///
/// Uses Unity's + pattern
/// for project-scoped editor settings. The asset file is plain YAML, diff-friendly, and
/// lives in the folder teams commit to VCS — so flipping
/// once and committing the resulting asset disables the update popup for every team member
/// who pulls that commit.
///
/// This complements (does not replace) the per-user "Do not show again" flag stored via
/// . Precedence is enforced in
/// : the project flag short-circuits
/// the check before the per-user flag is consulted.
///
/// See .
///
///
/// resolves the relative path against
/// the Unity project root (the folder that contains Assets/, Packages/, and
/// ProjectSettings/) — NOT against Assets/. That places the asset alongside
/// other team-shared editor settings such as ProjectSettings/EditorSettings.asset.
///
[FilePath("ProjectSettings/AI-Game-Developer-UpdateSettings.asset", FilePathAttribute.Location.ProjectFolder)]
internal sealed class UnityMcpUpdateProjectSettings : ScriptableSingleton
{
[SerializeField] private bool disableUpdateNotificationsForTeam;
///
/// When true, the update popup is suppressed for every team member who has this
/// asset in their checkout — regardless of any per-user state.
///
///
/// Setter persists immediately via with
/// saveAsText: true so the resulting asset is YAML (diff-friendly).
///
public bool DisableUpdateNotificationsForTeam
{
get => disableUpdateNotificationsForTeam;
set
{
if (disableUpdateNotificationsForTeam == value)
return;
disableUpdateNotificationsForTeam = value;
Save(true);
}
}
}
}