Skip to content

Commit a1e7bf8

Browse files
author
Thomas Hummes
committed
Updated Readme and SampleFile
1 parent ec66c34 commit a1e7bf8

File tree

2 files changed

+95
-28
lines changed

2 files changed

+95
-28
lines changed

Editor/Sample/ScreenshotTest.cs

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,19 @@ namespace UnityEditorHelper
66
[CustomEditor(typeof (SampleScript))]
77
public class ScreenshotTest : Editor
88
{
9+
public Vector2 _scrollPos;
10+
private bool state;
11+
912
public override void OnInspectorGUI()
1013
{
11-
using (new HighlightBox())
12-
{
13-
EditorGUILayout.Slider("Range property", 5, 0, 10);
14-
EditorGUILayout.TextField("Sample Field", GUILayout.Height(150));
15-
EditorGUILayout.ObjectField("Object Field", null, typeof (Transform), true);
16-
}
17-
18-
using (new HighlightBox(Color.red))
14+
using (new FoldableBlock(ref state, "Foldable Block"))
1915
{
20-
EditorGUILayout.Slider("Range property", 5, 0, 10);
21-
EditorGUILayout.TextField("Sample Field", GUILayout.Height(150));
22-
EditorGUILayout.ObjectField("Object Field", null, typeof(Transform), true);
16+
if(state)
17+
{
18+
EditorGUILayout.Slider("Range property", 5, 0, 10);
19+
EditorGUILayout.TextField("Sample Field", GUILayout.Height(150));
20+
EditorGUILayout.ObjectField("Object Field", null, typeof (Transform), true);
21+
}
2322
}
2423
}
2524
}

README.md

Lines changed: 85 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,92 @@
11
# UnityEditorHelper
22
An organized bunch of scripts to make editor scripting in Unity easier - gathered from some of my projects and other free sources
33

4-
# Samples
4+
## Samples
55

6-
## HighlightBox
6+
### HighlightBox
77
A box with round edges that can be colored and used to highlight some components
88

9-
![Alt Text](https://imgur.com/41b7dYL)
9+
![Imgur](http://i.imgur.com/41b7dYL.png)
1010

11-
using (new HighlightBox())
12-
{
13-
EditorGUILayout.Slider("Range property", 5, 0, 10);
14-
EditorGUILayout.TextField("Sample Field", GUILayout.Height(150));
15-
EditorGUILayout.ObjectField("Object Field", null, typeof (Transform), true);
16-
}
17-
18-
using (new HighlightBox(Color.red))
19-
{
20-
EditorGUILayout.Slider("Range property", 5, 0, 10);
21-
EditorGUILayout.TextField("Sample Field", GUILayout.Height(150));
22-
EditorGUILayout.ObjectField("Object Field", null, typeof(Transform), true);
23-
}
24-
11+
```csharp
12+
using (new HighlightBox())
13+
{
14+
EditorGUILayout.Slider("Range property", 5, 0, 10);
15+
EditorGUILayout.TextField("Sample Field", GUILayout.Height(150));
16+
EditorGUILayout.ObjectField("Object Field", null, typeof (Transform), true);
17+
}
18+
19+
using (new HighlightBox(Color.red))
20+
{
21+
EditorGUILayout.Slider("Range property", 5, 0, 10);
22+
EditorGUILayout.TextField("Sample Field", GUILayout.Height(150));
23+
EditorGUILayout.ObjectField("Object Field", null, typeof(Transform), true);
24+
}
25+
```
26+
27+
### EditorBlock
28+
A wrapper for vertical and horizontal oriented blocks that also accepts and additional style.
29+
30+
![Imgur](http://i.imgur.com/NhPueAu.png)
31+
32+
```csharp
33+
using (new EditorBlock(EditorBlock.Orientation.Vertical, "Box"))
34+
{
35+
EditorGUILayout.Slider("Range property", 5, 0, 10);
36+
EditorGUILayout.TextField("Sample Field", GUILayout.Height(150));
37+
EditorGUILayout.ObjectField("Object Field", null, typeof(Transform), true);
38+
}
39+
```
40+
41+
### SwitchColor
42+
A wrapper to change the GUIColor automatically without manually caching it and switching it back
43+
44+
![Imgur](http://i.imgur.com/VEBDzBi.png)
45+
46+
```csharp
47+
using (new SwitchColor(Color.cyan))
48+
{
49+
EditorGUILayout.Slider("Range property", 5, 0, 10);
50+
}
51+
52+
using (new SwitchColor(Color.green))
53+
{
54+
EditorGUILayout.TextField("Sample Field", GUILayout.Height(150));
55+
}
56+
57+
EditorGUILayout.ObjectField("Object Field", null, typeof(Transform), true);
58+
```
59+
60+
### IdentBlock
61+
A wrapper to indent controls
62+
63+
![Imgur](http://i.imgur.com/Zf17FFg.png)
64+
65+
```csharp
66+
using (new IndentBlock())
67+
{
68+
EditorGUILayout.Slider("Range property", 5, 0, 10);
69+
using (new IndentBlock())
70+
{
71+
EditorGUILayout.TextField("Sample Field", GUILayout.Height(150));
72+
EditorGUILayout.ObjectField("Object Field", null, typeof (Transform), true);
73+
}
74+
}
75+
```
76+
77+
### FoldableBlock
78+
A simple foldable block with a header. Can have an optional icon.
79+
80+
![Imgur](http://i.imgur.com/cyuogg2.png)
81+
82+
```csharp
83+
using (new FoldableBlock(ref state, "Foldable Block"))
84+
{
85+
if(state)
86+
{
87+
EditorGUILayout.Slider("Range property", 5, 0, 10);
88+
EditorGUILayout.TextField("Sample Field", GUILayout.Height(150));
89+
EditorGUILayout.ObjectField("Object Field", null, typeof (Transform), true);
90+
}
91+
}
92+
```

0 commit comments

Comments
 (0)