暂无描述
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

EditorPreferencesProviderView.cs 1.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. using UnityEngine;
  2. using UnityEditor;
  3. namespace Unity.VisualScripting
  4. {
  5. internal class EditorPreferencesProviderView : SettingsProvider
  6. {
  7. private const string Path = "Preferences/Visual Scripting";
  8. private const string Title = "Visual Scripting";
  9. private const string ID = "Bolt";
  10. private readonly GUIStyle marginStyle = new GUIStyle() { margin = new RectOffset(10, 10, 10, 10) };
  11. public EditorPreferencesProviderView() : base(Path, SettingsScope.User)
  12. {
  13. label = Title;
  14. }
  15. private void EnsureConfig()
  16. {
  17. if (BoltCore.instance == null || BoltCore.Configuration == null)
  18. {
  19. PluginContainer.Initialize();
  20. }
  21. }
  22. public override void OnGUI(string searchContext)
  23. {
  24. EnsureConfig();
  25. GUILayout.BeginVertical(marginStyle);
  26. // happens when opening unity with the settings window already opened. there's a delay until the singleton is assigned
  27. if (BoltCore.instance == null)
  28. {
  29. EditorGUILayout.HelpBox("Loading Configuration...", MessageType.Info);
  30. return;
  31. }
  32. var instance = (BoltProduct)ProductContainer.GetProduct(ID);
  33. instance.configurationPanel.PreferenceItem();
  34. GUILayout.EndVertical();
  35. }
  36. }
  37. }