How do I allow users to resize columns in custom editor windows?
I've been poking around the internet and the Unity site for quite some time now and I just can't seem to find a proper answer or direction to go in. Any help would be appreciated.
Pretty much I have a custom editor window (screenshot above) and sometimes the path gets pretty long and the unique name has that potential as well. I was wondering if there was a way to allow the user to drag and change the column width. My code is pretty much kind of laid out like this:
GUIStyle styleSelectedAudio = new GUIStyle();
styleSelectedAudio.normal.background = SetBackground(1, 1, new Color(0.1f, 0.1f, 0.1f, 0.2f));
GUIStyle styleIncludeToggle = new GUIStyle();
styleIncludeToggle.padding = new RectOffset(25, 0, 0, 0);
AudioImporter aImporter = AssetImporter.GetAtPath(soundBankList[i].path) as AudioImporter;
if (m_intSelectAudio != soundBankList[i].id)
EditorGUILayout.BeginHorizontal();
else
EditorGUILayout.BeginHorizontal(styleSelectedAudio);
if (GUILayout.Button("Edit", GUILayout.MinWidth(50.0f), GUILayout.MaxWidth(50.0f)))
{
m_intSelectAudio = soundBankList[i].id;
SoundBankAudioEditor window = (SoundBankAudioEditor)EditorWindow.GetWindow(typeof(SoundBankAudioEditor));
}
EditorGUILayout.BeginHorizontal(styleIncludeToggle, GUILayout.MinWidth(70.0f), GUILayout.MaxWidth(70.0f));
soundBankList[i].include = EditorGUILayout.Toggle(soundBankList[i].include);
EditorGUILayout.EndHorizontal();
EditorGUILayout.LabelField(soundBankList[i].id.ToString(), GUILayout.MinWidth(40.0f), GUILayout.MaxWidth(40.0f));
EditorGUILayout.LabelField(soundBankList[i].length.ToString("F2") + "s", GUILayout.MinWidth(80.0f), GUILayout.MaxWidth(80.0f));
if (soundBankList[i].uniqueName == null || soundBankList[i].uniqueName == "")
EditorGUILayout.LabelField("-", GUILayout.MinWidth(200.0f), GUILayout.MaxWidth(200.0f));
else
EditorGUILayout.LabelField(soundBankList[i].uniqueName, GUILayout.MinWidth(200.0f), GUILayout.MaxWidth(200.0f));
EditorGUILayout.LabelField(soundBankList[i].fileName, GUILayout.MinWidth(200.0f), GUILayout.MaxWidth(200.0f));
EditorGUILayout.LabelField(soundBankList[i].extension, GUILayout.MinWidth(80.0f), GUILayout.MaxWidth(80.0f));
EditorGUILayout.LabelField(soundBankList[i].path.ToString(), GUILayout.MinWidth(800.0f), GUILayout.MaxWidth(1000.0f));
EditorGUILayout.EndHorizontal();
Your answer
Follow this Question
Related Questions
Editor Int sliders affecting each other 0 Answers
How to make my scene object reference survive the button play 1 Answer
How to Undo a bool on an EditorWindow 1 Answer
Creating an Inspector view that only changes on scene hierarchy selection or asset selection 1 Answer
Unity Android Build Publishing Settings are not saved When changed with Preset or by script 0 Answers