private void DrawGeneratorSetting( GeneratorEntry entry, NodeGUI node, AssetReferenceStreamManager streamManager, NodeGUIEditor editor, Action onValueChanged) { var generator = entry.m_instance.Get <IAssetGenerator>(editor.CurrentEditingGroup); using (new EditorGUILayout.VerticalScope(GUI.skin.box)) { using (new GUILayout.HorizontalScope()) { var newName = EditorGUILayout.TextField("Name", entry.m_name); if (newName != entry.m_name) { using (new RecordUndoScope("Change Name", node, true)) { entry.m_name = newName; UpdateGeneratorEntry(node, entry); onValueChanged(); } } if (GUILayout.Button(m_popupIcon, GUI.skin.label, GUILayout.Width(20f))) { var menu = new GenericMenu(); menu.AddItem(new GUIContent("Remove Generator"), false, () => { m_removingEntry = entry; }); menu.ShowAsContext(); } } var map = AssetGeneratorUtility.GetAttributeAssemblyQualifiedNameMap(); if (map.Count > 0) { using (new GUILayout.HorizontalScope()) { GUILayout.Label("AssetGenerator"); var guiName = AssetGeneratorUtility.GetGUIName(entry.m_instance.ClassName); if (GUILayout.Button(guiName, "Popup", GUILayout.MinWidth(150f))) { var builders = map.Keys.ToList(); if (builders.Count > 0) { NodeGUI.ShowTypeNamesMenu(guiName, builders, (string selectedGUIName) => { using (new RecordUndoScope("Change AssetGenerator class", node, true)) { generator = AssetGeneratorUtility.CreateGenerator(selectedGUIName); entry.m_instance.Set(editor.CurrentEditingGroup, generator); onValueChanged(); } } ); } } MonoScript s = TypeUtility.LoadMonoScript(entry.m_instance.ClassName); using (new EditorGUI.DisabledScope(s == null)) { if (GUILayout.Button("Edit", GUILayout.Width(50))) { AssetDatabase.OpenAsset(s, 0); } } } } else { if (!string.IsNullOrEmpty(entry.m_instance.ClassName)) { EditorGUILayout.HelpBox( $"Your AssetGenerator script {entry.m_instance.ClassName} is missing from assembly. Did you delete script?", MessageType.Info); } else { string[] menuNames = Model.Settings.GUI_TEXT_MENU_GENERATE_ASSETGENERATOR.Split('/'); EditorGUILayout.HelpBox( $"You need to create at least one AssetGenerator script to use this node. To start, select {menuNames[1]}>{menuNames[2]}>{menuNames[3]} menu and create new script from template.", MessageType.Info); } } GUILayout.Space(10f); editor.DrawPlatformSelector(node); using (new EditorGUILayout.VerticalScope()) { var disabledScope = editor.DrawOverrideTargetToggle(node, entry.m_instance.ContainsValueOf(editor.CurrentEditingGroup), (bool enabled) => { if (enabled) { entry.m_instance.CopyDefaultValueTo(editor.CurrentEditingGroup); } else { entry.m_instance.Remove(editor.CurrentEditingGroup); } onValueChanged(); }); using (disabledScope) { if (generator != null) { Action onChangedAction = () => { using (new RecordUndoScope("Change AssetGenerator Setting", node)) { entry.m_instance.Set(editor.CurrentEditingGroup, generator); onValueChanged(); } }; generator.OnInspectorGUI(onChangedAction); } } } } }