![]() Public class ResizablePanels : EditorWindowī = new Color(0.9f, 0.9f, 0.9f) īoxBgSelected = EditorGUIUtility.Over the years of working with Unity I've picked up tips and tricks on how to better improve my workflow. = EditorGUIUtility.Load("builtin skins/darkskin/images/projectbrowsericonareabg.png") as Texture2D Return GUILayout.Button(new GUIContent(content, icon), boxStyle, GUILayout.ExpandWidth(true), GUILayout.Height(30)) Private bool DrawBox(string content, BoxType boxType, bool isOdd, bool isSelected)ī = boxBgSelected Ĭase LogType.Error: icon = errorIcon break Ĭase LogType.Exception: icon = errorIcon break Ĭase LogType.Assert: icon = errorIcon break Ĭase LogType.Warning: icon = warningIcon break Ĭase LogType.Log: icon = infoIcon break GUILayout.BeginArea(new Rect(resizer.position + (Vector2.up * resizerHeight), new Vector2(position.width, 2)), resizerStyle) ĮditorGUIUtility.AddCursorRect(resizer, MouseCursor.ResizeVertical) ![]() Resizer = new Rect(0, (position.height * sizeRatio) - resizerHeight, position.width, resizerHeight * 2) = EditorGUIUtility.Load("icons/d_AvatarBlendBackground.png") as Texture2D ī = new Color(0.7f, 0.7f, 0.7f) īoxBgOdd = EditorGUIUtility.Load("builtin skins/darkskin/images/cn entrybackodd.png") as Texture2D īoxBgEven = EditorGUIUtility.Load("builtin skins/darkskin/images/cnentrybackeven.png") as Texture2D īoxBgSelected = EditorGUIUtility.Load("builtin skins/darkskin/images/menuitemhover.png") as Texture2D InfoIconSmall = EditorGUIUtility.Load("icons/") as Texture2D WarningIconSmall = EditorGUIUtility.Load("icons/") as Texture2D InfoIcon = EditorGUIUtility.Load("icons/") as Texture2D ĮrrorIconSmall = EditorGUIUtility.Load("icons/") as Texture2D WarningIcon = EditorGUIUtility.Load("icons/") as Texture2D ShowErrors = GUILayout.Toggle(showErrors, new GUIContent("E", errorIconSmall), EditorStyles.toolbarButton, GUILayout.Width(30)) ĮrrorIcon = EditorGUIUtility.Load("icons/") as Texture2D ShowWarnings = GUILayout.Toggle(showWarnings, new GUIContent("W", warningIconSmall), EditorStyles.toolbarButton, GUILayout.Width(30)) ShowLog = GUILayout.Toggle(showLog, new GUIContent("L", infoIconSmall), EditorStyles.toolbarButton, GUILayout.Width(30)) ShowErrors = GUILayout.Toggle(showErrors, new GUIContent("E"), EditorStyles.toolbarButton, GUILayout.Width(30)) ShowWarnings = GUILayout.Toggle(showWarnings, new GUIContent("W"), EditorStyles.toolbarButton, GUILayout.Width(30)) ShowLog = GUILayout.Toggle(showLog, new GUIContent("L"), EditorStyles.toolbarButton, GUILayout.Width(30)) GUILayout.Button(new GUIContent("Clear"), EditorStyles.toolbarButton, GUILayout.Width(35)) Ĭollapse = GUILayout.Toggle(collapse, new GUIContent("Collapse"), EditorStyles.toolbarButton, GUILayout.Width(50)) ĬlearOnPlay = GUILayout.Toggle(clearOnPlay, new GUIContent("Clear On Play"), EditorStyles.toolbarButton, GUILayout.Width(70)) ĮrrorPause = GUILayout.Toggle(errorPause, new GUIContent("Error Pause"), EditorStyles.toolbarButton, GUILayout.Width(60)) GUILayout.BeginArea(menuBar, EditorStyles.toolbar) MenuBar = new Rect(0, 0, position.width, menuBarHeight) I left a magic number as the height of the resizer area, and I would like to convert it to a proper variable: ![]() But, before we do, I would like to fix a tiny issue from the previous post’s code. Boxes change color when you click on them, and their content is displayed in the bottom panel (3), a text area which is not editable but selectable.Īlright then, we can start. ![]() Then there is a scroll view (2) that contains clickable boxes with icons and text. The button clears the window, while toggles turn on and off specific options. ![]() The button and three toggles are aligned to left, and the remaining toggles are aligned to right. The window starts with a menu bar (1) which has one button and six toggles. This post is going to be a little bit longer, so I will omit the previously written code, but the final version will still be available in full at the end.īefore we start coding, let’s examine the console window and see what we should add. In this post, we will improve upon it and make it a clone of Unity’s console window. In our last post we created a Unity window and added two resizable panels. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |