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