Skip to content

Instantly share code, notes, and snippets.

@kirevdokimov
Created August 12, 2017 16:41
Show Gist options
  • Save kirevdokimov/df5ce980ce992e40a72197bffdb3f130 to your computer and use it in GitHub Desktop.
Save kirevdokimov/df5ce980ce992e40a72197bffdb3f130 to your computer and use it in GitHub Desktop.
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);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment