Draw the built-in inspector.
virtual public bool DrawInspector(NPipeEditFlags flags) { UnityEditor.Editor editor = UnityEditor.Editor.CreateEditor(this); bool changed = editor.DrawDefaultInspector(); if ((flags & NPipeEditFlags.INPUT) == NPipeEditFlags.INPUT) { SOURCE_FACTORY newSource = NPipelineUtils.DrawSourceSelector <SOURCE_FACTORY>("Input", input as SOURCE_FACTORY); if (newSource as NPVoxForwarderBase <SOURCE_FACTORY, PRODUCT> == this) { return(false); } changed = newSource != Input || changed; Input = (NPipeIImportable)newSource; } // if((flags & NPVoxEditFlags.TOOLS) == NPVoxEditFlags.TOOLS) // { // if(GUILayout.Button("Invalidate & Reimport Mesh Output Deep")) // { // NPVoxPipelineUtils.InvalidateAndReimportDeep( this ); // } // } return(changed); }
void DrawBuildUpload() { EnsureMetricsFileExists(); { GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); if (GUILayout.Button(kGoToDashboardText, new[] { GUILayout.Width(RedirectBtnWidth) })) { Help.BrowseURL(GameSimLinks["dashboard"]); } GUILayout.EndHorizontal(); } buildSettingsScenes = GetBuildSettingScenes(); openScenes = GetOpenScenes(); EditorGUILayout.LabelField(kMessageString, EditorStyles.wordWrappedLabel); DrawScenes(); var location = Path.Combine("Assets", "..", "Build", string.IsNullOrEmpty(buildName) ? "BuildName" : buildName); EditorGUILayout.LabelField(kLocationText, location); buildName = EditorGUILayout.TextField(kFieldText, buildName); DrawButtons(); metricsEditor.DrawDefaultInspector(); }
virtual public bool DrawMultiInstanceEditor(NPipeEditFlags flags, UnityEngine.Object[] objects) { UnityEditor.Editor editor = UnityEditor.Editor.CreateEditor(objects); bool changed = editor.DrawDefaultInspector(); if ((flags & NPipeEditFlags.STORAGE_MODE) == NPipeEditFlags.STORAGE_MODE) { GUILayout.BeginHorizontal(); GUILayout.Label("Storage Mode"); NPipeStorageMode newStorageMode = (NPipeStorageMode)GUILayout.Toolbar((int)storageMode, new string[] { "RAM", "RESOURCE_CACHE", "ATTACHED" }); foreach (UnityEngine.Object o in objects) { if (((NPVoxProcessorBase <PRODUCT>)o).storageMode != storageMode) { ((NPVoxProcessorBase <PRODUCT>)o).storageMode = newStorageMode; changed = true; } } if (newStorageMode != storageMode) { this.storageMode = newStorageMode; changed = true; } GUILayout.EndHorizontal(); GUILayout.Space(2f); } return(changed); }
virtual public bool DrawMultiInstanceEditor(NPipeEditFlags flags, UnityEngine.Object[] objects) { UnityEditor.Editor editor = UnityEditor.Editor.CreateEditor(objects); bool changed = editor.DrawDefaultInspector(); return(changed); }
private void DrawTileEditor() { if (viewModel.CurrentPrefab != null) { GUILayout.Label("Tile Settings: " + viewModel.CurrentPrefabPath); GNBlockMapTile tile = viewModel.CurrentPrefab.GetComponent <GNBlockMapTile>(); if (tile) { UnityEditor.Editor editor = UnityEditor.Editor.CreateEditor(tile); bool changed = editor.DrawDefaultInspector(); if (changed) { // blubb } if (GUILayout.Button("Delete Tile Component in current Prefab")) { Undo.DestroyObjectImmediate(viewModel.CurrentPrefab.GetComponent <GNBlockMapTile>()); // Repaint(); } } else { if (GUILayout.Button("Create Tile Component in current Prefab")) { GNBlockMapTile tile2 = viewModel.CurrentPrefab.AddComponent <GNBlockMapTile>(); Undo.RegisterCreatedObjectUndo(tile2, "Painted an Object"); // Repaint(); // EditorUtility.SetDirty(viewModel.CurrentPrefab); } } } }
public override void OnInspectorGUI() { // Show the Spawner picker var newSpawner = (MultiSpawner)EditorGUILayout.ObjectField( new GUIContent("Graph Spawner"), _arranger.GraphSpawner, typeof(MultiSpawner), allowSceneObjects: true); if (newSpawner == null && _arranger.GraphSpawner != null) { DestroyImmediate(_spawnerEditor); } _arranger.GraphSpawner = newSpawner; // Show the Spawner inspector right in this Inspector if (_spawnerEditor == null && _arranger.GraphSpawner != null) { _spawnerEditor = CreateEditor(_arranger.GraphSpawner); } if (_spawnerEditor != null) { _spawnerEditor.DrawDefaultInspector(); EditorGUILayout.Space(); } DrawDefaultInspector(); // Draw buttons EditorGUILayout.Space(); if (GUILayout.Button($"Reset Nodes")) { _arranger.ResetNodes(); } }
public static void DrawGUI(this PluginData data) { if (_editor == null) { _editor = UnityEditor.Editor.CreateEditor(data); } _editor.DrawDefaultInspector(); }
// Called by CustomMonoBehaviourEditor public virtual void ShowInspectorGUI(Editor editor) { showDefaultInspector = EditorGUILayout.Toggle("Show default inspector?", showDefaultInspector); EditorGUILayout.Space(); if (showDefaultInspector) editor.DrawDefaultInspector(); }
void ModifyAction() { EditorGUILayout.LabelField("Action", EditorStyles.boldLabel); // Set the action EditorGUILayout.BeginHorizontal(); EditorGUILayout.PropertyField(Type); if (GUILayout.Button("Set", EditorStyles.miniButtonRight)) { var action = StatefulAction.AddInstanceToAsset(StatefulAction.Type.Type.DeclaringType) as Action; StatefulAction.Action = action; } EditorGUILayout.EndHorizontal(); // If an action has been set, show it if (StatefulAction.Action && !ActionEditor) { ActionEditor = UnityEditor.Editor.CreateEditor(StatefulAction.Action); } ActionEditor.DrawDefaultInspector(); }
void OnGUI() { if (GUILayout.Button("Create", GUILayout.MaxWidth(EditorGUIUtility.labelWidth))) { tabletopSoldierDataContainer.TabletopSoldierTeamData = new TabletopSoldierTeamData(); } EditorGUI.BeginChangeCheck(); selectedTeamIndex = EditorGUILayout.Popup(selectedTeamIndex, teamNames, GUILayout.MaxWidth(EditorGUIUtility.labelWidth)); if (EditorGUI.EndChangeCheck()) { var jsonData = File.ReadAllText(files[selectedTeamIndex]); tabletopSoldierDataContainer.TabletopSoldierTeamData = JsonUtility.FromJson <TabletopSoldierTeamData>(jsonData); } if (GUILayout.Button("Refresh", GUILayout.MaxWidth(EditorGUIUtility.labelWidth))) { refreshFiles(); } if (GUILayout.Button("Save", GUILayout.MaxWidth(EditorGUIUtility.labelWidth))) { save(); } scrollPosition = EditorGUILayout.BeginScrollView(scrollPosition); if (editor != null) { EditorGUI.BeginChangeCheck(); editor.DrawDefaultInspector(); if (EditorGUI.EndChangeCheck()) { // save(); } } EditorGUILayout.EndScrollView(); }
virtual public bool DrawInspector(NPipeEditFlags flags) { UnityEditor.Editor editor = UnityEditor.Editor.CreateEditor(this); bool changed = editor.DrawDefaultInspector(); if ((flags & NPipeEditFlags.STORAGE_MODE) == NPipeEditFlags.STORAGE_MODE) { GUILayout.BeginHorizontal(); GUILayout.Label("Storage Mode"); NPipeStorageMode newStorageMode = (NPipeStorageMode)GUILayout.Toolbar((int)storageMode, new string[] { "RAM", "RESOURCE_CACHE", "ATTACHED" }); if (newStorageMode != storageMode) { this.storageMode = newStorageMode; changed = true; } GUILayout.EndHorizontal(); GUILayout.Space(2f); } return(changed); }
public static void DrawAddons(MonoBehaviour target, AddOnTarget addOnTarget) { if (Addons.Count == 0) { GUILayout.Label("No Add-On(s) are available for this component.", EditorStyles.miniLabel); } else { foreach (AddOnAttribute Addon in Addons) { if (Addon.Target == addOnTarget) { GUILayout.BeginVertical("box"); GUILayout.BeginHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Space(3); GUILayout.Label(Addon.Name, EditorStyles.label); GUILayout.FlexibleSpace(); GUI.color = GetEditorColor; if (GUILayout.Button("About This", GUILayout.Width(100))) { EditorUtility.DisplayDialog("Easy Build System - Information", "Name : " + Addon.Name + "\nAuthor : " + Addon.Author, "Ok"); } if (target.gameObject.GetComponent(Addon.Behaviour) == null) { GUI.color = new Color(0f, 1.5f, 0f); if (GUILayout.Button("Enable Add-On", GUILayout.Width(130))) { if (target.gameObject.GetComponent(Addon.Behaviour) != null) { return; } Component Com = target.gameObject.AddComponent(Addon.Behaviour); Com.hideFlags = HideFlags.HideInInspector; } } else { GUI.color = new Color(2f, 0f, 0f); if (GUILayout.Button("Disable Add-On", GUILayout.Width(130))) { try { DestroyImmediate(target.gameObject.GetComponent(Addon.Behaviour)); break; } catch { } } } GUILayout.EndHorizontal(); GUILayout.EndHorizontal(); GUI.color = Color.white; if (target.gameObject.GetComponent(Addon.Behaviour) != null) { EditorGUILayout.HelpBox(Addon.Description, MessageType.Info); GUILayout.BeginHorizontal(); GUILayout.Space(13); GUILayout.BeginVertical(); UnityEditor.Editor AddonEditor = UnityEditor.Editor.CreateEditor(target.gameObject.GetComponent(Addon.Behaviour)); AddonEditor.DrawDefaultInspector(); GUILayout.EndVertical(); GUILayout.EndHorizontal(); } GUILayout.EndVertical(); } } } }
protected override void CustomOnGUI() { UnityEditor.Editor editor = null; UnityEditor.Editor.CreateCachedEditor(target, null, ref editor); editor.DrawDefaultInspector(); }
private void OnGUI() { if (GUILayout.Button("Build Vehicle", GUILayout.MinHeight(100), GUILayout.Height(50))) { CreateVehicle(); } scrollPos = EditorGUILayout.BeginScrollView(scrollPos, GUILayout.Width(position.width), GUILayout.Height(position.height - 75f)); CreateLabelField("Vehicle", true); EditorGUILayout.BeginHorizontal(); CreateLabelField("Vehicle Name"); vehicleName = EditorGUILayout.TextField(vehicleName); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); CreateLabelField("Vehicle Model"); vehicleModel = (GameObject)EditorGUILayout.ObjectField(vehicleModel, typeof(GameObject), false); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); CreateLabelField("Vehicle Type"); vehicleType = (VehicleType)EditorGUILayout.EnumPopup(vehicleType); EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal(); CreateLabelField("Physics Material"); physicsMaterial = (PhysicMaterial)EditorGUILayout.ObjectField(physicsMaterial, typeof(PhysicMaterial), false); EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); CreateLabelField("Body Name", true); EditorGUILayout.BeginHorizontal(); CreateLabelField("Vehicle Body"); vehicleBodyName = EditorGUILayout.TextField(vehicleBodyName); EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); CreateLabelField("Wheel Names", true); if (vehicleType == VehicleType.FourWheels) { DisplayTwoWheels(); DisplayFourWheels(); } else if (vehicleType == VehicleType.TwoWheels) { DisplayTwoWheels(); } EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal(); CreateLabelField("Vehicle Settings"); vehicleSettings = (VehicleBehaviourSettings)EditorGUILayout.ObjectField(vehicleSettings, typeof(VehicleBehaviourSettings), false); EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); CreateLabelField("Optional Components", true); EditorGUILayout.BeginHorizontal(); CreateLabelField("Add effects component"); addEffectsComponent = EditorGUILayout.Toggle("", addEffectsComponent); EditorGUILayout.EndHorizontal(); if (addEffectsComponent == true) { DisplayEffects(); } EditorGUILayout.BeginHorizontal(); CreateLabelField("Add example input"); addExampleInput = EditorGUILayout.Toggle("", addExampleInput); EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); CreateLabelField("Custom components", true); reorderableBehavioursList.DoLayoutList(); UnityEditor.Editor editor = UnityEditor.Editor.CreateEditor(this); editor.DrawDefaultInspector(); EditorGUILayout.EndScrollView(); }