EditorStateProvider.cs 716 B

123456789101112131415161718192021222324252627
  1. using UnityEditor;
  2. using UnityEngine;
  3. namespace LLM.Editor.Analysis
  4. {
  5. /// <summary>
  6. /// Provides context about the current state of the Unity Editor (Play, Edit, Paused).
  7. /// </summary>
  8. public class EditorStateProvider : IContextProvider
  9. {
  10. public class EditorStateResult
  11. {
  12. public string currentState;
  13. }
  14. public object GetContext(Object target, string qualifier)
  15. {
  16. var state = "EditMode";
  17. if (EditorApplication.isPlaying)
  18. {
  19. state = EditorApplication.isPaused ? "Paused" : "PlayMode";
  20. }
  21. return new EditorStateResult { currentState = state };
  22. }
  23. }
  24. }