- Home /
Question by
QFSW · Mar 17, 2017 at 07:25 PM ·
c#editor-scriptingeditorwindoweditor extension
Editor GUI text becoming misaligned
Hi all,
I'm currently working on my editor extension and decided to add a custom button using an image instead, which was then put on the same row as a text field using a horizontal layout group
Unfortunately, the textfield stops being aligned to the centre.
Here is the code in question with the problem
GUILayout.BeginHorizontal();
GUIStyle Style = EditorStyles.textField;
Style.alignment = TextAnchor.UpperLeft;
OutputPath = EditorGUILayout.TextField(new GUIContent("Output Path"), OutputPath, Style);
if (DesiredPathType == PathType.Absolute)
{
Style = GUIStyle.none;
Style.padding = new RectOffset(0, 0, 2, 0);
if (GUILayout.Button(new GUIContent(FolderIcon), Style, GUILayout.MaxHeight(16), GUILayout.MaxWidth(19)))
{
string Selection = EditorUtility.OpenFolderPanel("Output directory", RootPath, "");
if (!String.IsNullOrEmpty(Selection)) { OutputPath = Selection.Replace(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar); }
}
}
GUILayout.EndHorizontal();
Does anybody know whats causing the issue and how I could fix it? Thanks
Comment