Advertisement
Guest User

Buttons

a guest
Mar 3rd, 2016
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.56 KB | None | 0 0
  1. public static ButtonNode[] bn = null;
  2.  
  3. void OnGUI()
  4. {
  5.     GUILayout.BeginHorizontal();
  6.  
  7.     if (bn == null)
  8.     {
  9.         bn = new ButtonNode[10];
  10.         for (int i = 0; i < bn.Lenght; ++i)
  11.         {
  12.             bn[i] = new ButtonNode();
  13.         }
  14.     }
  15.  
  16.     for (int i = 0; i < bn.length; i++)
  17.     {
  18.         // this line has to be removed, to avoid recreation of buttons
  19.         // bn[i] = new ButtonNode();
  20.         if (bn[i].button = GUILayout.Button(bn[i].name + i, GUILayout.Width(bn[i].sizeW)))
  21.         {
  22.             bn[i].AlterButton();
  23.         }
  24.     }
  25.  
  26.     GUILayout.EndHorizontal();
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement