Fix editor TextField cursor alignment

Whenever I increase the font size of my TextField it makes the cursor and highlight shift down. Is there a way to fix this?


I’m using this custom GUIStyle:

  MyStyle = new GUIStyle(EditorStyles.textField);
  MyStyle.fixedHeight = 64;
  MyStyle.alignment = TextAnchor.MiddleLeft;
  MyStyle.fontSize = 32;

And I’m rendering the TextField like this:

  query = EditorGUILayout.TextField(query, MyStyle,

Removing the GUILayout.Height and fixedHeight don’t seem to have an effect outside of layout (the cursor and highlight is still offset the same way).

This turned out to be a font scaling issue. The solution is to create a font in the size needed since even dynamic fonts are not handled properly for text fields.