/// This function is called when the user clicks on the MyCustom element in the Settings window. public override void OnActivate(string searchContext, VisualElement rootElement) { if (PrateekSettings.Instance != null) { PrateekSettings.InitGUI(); } }
public override void OnGUI(string searchContext) { DrawSettingsPrompt("Prateek Main Settings", PrateekSettings.Instance != null, () => PrateekSettings.CreateSettings()); if (!PrateekSettings.Instance) { return; } EditorGUILayout.Space(); EditorGUILayout.LabelField("Settings", EditorStyles.boldLabel); using (new EditorGUI.IndentLevelScope()) { PrateekSettings.OnGUI(searchContext); } if (FrameworkSettingsForagerWorker.Instance == null) { return; } EditorGUILayout.Space(); EditorGUILayout.LabelField("Framework Custom Settings", EditorStyles.boldLabel); using (new EditorGUI.IndentLevelScope()) { foreach (var foundType in FrameworkSettingsForagerWorker.Instance.FoundTypes) { if (!frameworkSettings.ContainsKey(foundType)) { frameworkSettings.Add(foundType, Activator.CreateInstance(foundType) as FrameworkSettings); } var frameworkSetting = frameworkSettings[foundType]; var assetPath = $"{ConstFolder.ASSETS_RESOURCES}/{frameworkSetting.DefaultPath}{ConstExtension.ASSET}"; var settingFile = AssetDatabase.LoadAssetAtPath(assetPath, frameworkSetting.ResourceType); DrawSettingsPrompt($"{foundType.Name}", settingFile != null, () => Create(frameworkSetting, assetPath)); } } }