Skip to content

Commit 7755573

Browse files
committed
Limit Input to 4 entries
1 parent 21f8031 commit 7755573

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

Editor/TexturePackerWindow.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public class TexturePackerWindow : EditorWindow
1010
{
1111
private readonly string _windowTitle = "Channel Packer";
1212
private readonly Vector2 _windowSize = new Vector2(300, 450);
13-
13+
private readonly int _maxInputCount = 4;
1414
private readonly int _textureSupportedResolutionMin = 64;
1515
private readonly int _textureSupportedResolutionMax = 8192;
1616

@@ -73,16 +73,24 @@ private void OnGUI()
7373

7474
GUILayout.Label("Inputs", TexturePackerStyles.Heading);
7575
foreach (TextureItem item in _items)
76+
{
7677
item.Draw();
78+
}
7779

7880
EditorGUILayout.BeginHorizontal();
7981
GUILayout.FlexibleSpace();
82+
83+
GUI.enabled = _items.Count < _maxInputCount;
84+
8085
if (GUILayout.Button("+"))
8186
{
8287
TextureInput entry = new TextureInput();
8388
_texturePacker.Add(entry);
8489
_items.Add(new TextureItem(entry));
8590
}
91+
92+
GUI.enabled = true;
93+
8694
GUILayout.FlexibleSpace();
8795
EditorGUILayout.EndHorizontal();
8896

0 commit comments

Comments
 (0)