@@ -6,16 +6,17 @@ namespace UnityToolbarExtender.Examples
66{
77 static class ToolbarStyles
88 {
9- public static GUIStyle commandButtonStyle ;
10- public static GUIStyle appToolbar ;
9+ public static readonly GUIStyle commandButtonStyle ;
1110
1211 static ToolbarStyles ( )
1312 {
14- commandButtonStyle = new GUIStyle ( "Command" ) ;
15- commandButtonStyle . fontSize = 16 ;
16- commandButtonStyle . alignment = TextAnchor . MiddleCenter ;
17- commandButtonStyle . imagePosition = ImagePosition . ImageAbove ;
18- commandButtonStyle . fontStyle = FontStyle . Bold ;
13+ commandButtonStyle = new GUIStyle ( "Command" )
14+ {
15+ fontSize = 16 ,
16+ alignment = TextAnchor . MiddleCenter ,
17+ imagePosition = ImagePosition . ImageAbove ,
18+ fontStyle = FontStyle . Bold
19+ } ;
1920 }
2021 }
2122
@@ -30,28 +31,16 @@ static SceneSwitchLeftButton()
3031 static void OnToolbarGUI ( )
3132 {
3233 GUILayout . FlexibleSpace ( ) ;
33- if ( GUILayout . Button ( "1" , ToolbarStyles . commandButtonStyle ) )
34+
35+ if ( GUILayout . Button ( new GUIContent ( "1" , "Start Scene 1" ) , ToolbarStyles . commandButtonStyle ) )
3436 {
3537 SceneHelper . StartScene ( "Assets/ToolbarExtender/Example/Scenes/Scene1.unity" ) ;
3638 }
37- }
38- }
39-
40- [ InitializeOnLoad ]
41- public class SceneSwitchRightButton
42- {
43- static SceneSwitchRightButton ( )
44- {
45- ToolbarExtender . RightToolbarGUI . Add ( OnToolbarGUI ) ;
46- }
4739
48- static void OnToolbarGUI ( )
49- {
50- if ( GUILayout . Button ( "2" , ToolbarStyles . commandButtonStyle ) )
40+ if ( GUILayout . Button ( new GUIContent ( "2" , "Start Scene 2" ) , ToolbarStyles . commandButtonStyle ) )
5141 {
5242 SceneHelper . StartScene ( "Assets/ToolbarExtender/Example/Scenes/Scene2.unity" ) ;
5343 }
54- GUILayout . FlexibleSpace ( ) ;
5544 }
5645 }
5746
0 commit comments