Nobinator
8/12/2017 - 4:41 PM

Toolbar window

public class ToolBarWindow : EditorWindow{
		private static Texture image;

		[MenuItem("Window/TestChamber/ToolBar")]
		public static void Init(){
			b();
			GetWindow<ToolBarWindow>().Show();
		}

		private void OnGUI(){DrawToolbar();}

		[DidReloadScripts]static void b(){image = Resources.Load("brackets") as Texture;}

		void DrawToolbar(){
			using (new EditorGUILayout.HorizontalScope(EditorStyles.toolbar)){
				GUILayout.Button("Button",EditorStyles.toolbarButton);
				GUIStyle gs = new GUIStyle(EditorStyles.toolbar){
					alignment = TextAnchor.MiddleCenter
				};
				GUILayout.FlexibleSpace();
				GUILayout.Label("Label is here ",gs);
				
				GUILayout.TextField("Textfield",EditorStyles.toolbarTextField);
				EditorGUILayout.Popup(2,new string[]{"Hello","Hi","Konichava"},EditorStyles.toolbarPopup);
			
				GUILayout.Button(new GUIContent("Button with icon", image, "Tool tip"), EditorStyles.toolbarButton);

			}
		}
}