using UnityEngine; using UnityEditor; namespace LLM.Editor.Commands { [System.Serializable] public class RequestSavePathParams { public string title; public string defaultName; public string extension; } public class RequestSavePathCommand : ICommand { private readonly RequestSavePathParams _params; public const string CONTEXT_KEY = "lastSavePath"; public RequestSavePathCommand(string jsonParams) { _params = JsonUtility.FromJson(jsonParams); } public void Execute(Data.CommandContext context) { var path = EditorUtility.SaveFilePanel(_params.title, "Assets/", _params.defaultName, _params.extension); if (string.IsNullOrEmpty(path)) return; // We need a relative path for AssetDatabase var relativePath = "Assets" + path[Application.dataPath.Length..]; context.transientData[CONTEXT_KEY] = relativePath; Debug.Log($"[RequestSavePathCommand] User selected path: {relativePath}"); } } }