Skip to content

Commit 657486e

Browse files
committed
Update samples
1 parent 2a10dc2 commit 657486e

5 files changed

Lines changed: 64 additions & 66 deletions

File tree

Assets/Examples/Scenes/SampleScene.unity

Lines changed: 17 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,10 @@ MonoBehaviour:
433433
- {fileID: 661896457}
434434
- {fileID: 5059060190599569098, guid: e4263a04cf09ace4b8568f054ea426ee, type: 3}
435435
- {fileID: 5059060190599569098, guid: e4263a04cf09ace4b8568f054ea426ee, type: 3}
436+
strings:
437+
- a
438+
- b
439+
- c
436440
ints: 01000000080000000c00000010000000
437441
var21: {fileID: 977748988}
438442
var22: {fileID: 2100000, guid: 7404c70251f9d0045a4aabaa49d83963, type: 2}
@@ -576,11 +580,18 @@ MonoBehaviour:
576580
var1:
577581
id: 0
578582
var2:
579-
go: {fileID: 0}
583+
id: 1
580584
references:
581585
version: 1
582586
00000000:
583-
type: {class: , ns: , asm: }
587+
type: {class: SampleBehaviour6/Struct, ns: , asm: Assembly-CSharp}
588+
data:
589+
var1: 1
590+
var2: 1
591+
00000001:
592+
type: {class: SampleBehaviour6/ClassWithInterface2, ns: , asm: Assembly-CSharp}
593+
data:
594+
var1: 0
584595
--- !u!4 &752799893
585596
Transform:
586597
m_ObjectHideFlags: 2
@@ -656,38 +667,22 @@ MonoBehaviour:
656667
m_EditorClassIdentifier:
657668
targetTag: Untagged
658669
progressBar: 25.4
659-
newLabel: 25.4
660670
var2: {x: 30.418846, y: 60.78535}
661-
var3: 1
662-
var4: 2
663-
var5: 3
664-
toggle1: 0
665-
var6: 0
666-
toggle2: 1
667-
var7: 21.44
668671
var8: {fileID: 977748987}
669-
var9: {fileID: 977748987}
670672
preview: {fileID: 5059060190599569102, guid: 5573ca52cac7c2d4cb2536e37e9be1f1, type: 3}
671673
var10: 2.16
672-
type1:
673-
typeReference:
674-
type2:
675-
typeReference: TMPro.TMP_SubMeshUI, Unity.TextMeshPro
676-
var11: Im read only
677674
var12: 0
678675
enumFlag: 12
679-
var13: {fileID: 0}
680-
randomValue: -7.3907948
681676
directory: Editor Toolbox/Editors
682677
sceneName: SampleScen
683678
presetTarget: 4
684679
enumSearch: 8
685-
clampedValue: 4.699999809265137
686680
password: password
681+
var13: {fileID: 0}
682+
clampedValue: 4.699999809265137
687683
sceneReference: {fileID: 0}
688684
childReference: {fileID: 0}
689685
prefabReference: {fileID: 0}
690-
hexColor: 4D7AC0FF
691686
sampleField:
692687
var1: {fileID: 2100000, guid: 7404c70251f9d0045a4aabaa49d83963, type: 2}
693688
var2: 0
@@ -710,20 +705,8 @@ MonoBehaviour:
710705
var3:
711706
var1: 0
712707
var2:
713-
scene1:
714-
sceneReference: {fileID: 102900000, guid: f11034f4657f51a47aac14f26410c500, type: 3}
715-
sceneName: SampleScene
716-
scenePath: Assets/Examples/Scenes/SampleScene.unity
717-
buildIndex: 0
718-
scene2:
719-
sceneReference: {fileID: 102900000, guid: f11034f4657f51a47aac14f26410c500, type: 3}
720-
sceneName: SampleScene
721-
scenePath: Assets/Examples/Scenes/SampleScene.unity
722-
buildIndex: 0
723708
bigNumber: 12345678
724709
currency: 20.41
725-
dateTime:
726-
ticks: 631466100000000000
727710
--- !u!4 &959025299
728711
Transform:
729712
m_ObjectHideFlags: 2
@@ -1116,6 +1099,8 @@ MonoBehaviour:
11161099
var28: {fileID: 0}
11171100
var39: 18
11181101
var55: 0
1102+
var56: 0
1103+
var57: 0
11191104
--- !u!4 &1438743619
11201105
Transform:
11211106
m_ObjectHideFlags: 2

Assets/Examples/Scripts/SampleBehaviour1.cs

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,25 @@
44
[AddComponentMenu("Editor Toolbox/Cheat Sheet 1 (Regular)")]
55
public class SampleBehaviour1 : MonoBehaviour
66
{
7-
[Label("TagSelector", skinStyle: SkinStyle.Box)]
7+
[Label("Tag Selector", skinStyle: SkinStyle.Box)]
88

99
[TagSelector]
1010
public string targetTag;
1111

12-
[Label("ProgressBar", skinStyle: SkinStyle.Box)]
12+
[Label("Progress Bar", skinStyle: SkinStyle.Box)]
1313

1414
[ProgressBar(minValue: -10.0f, maxValue: 50.0f, HexColor = "#234DEA")]
1515
public float progressBar = 25.4f;
1616

17-
[Label("MinMaxSlider", skinStyle: SkinStyle.Box)]
17+
[Label("MinMax Slider", skinStyle: SkinStyle.Box)]
1818

1919
[MinMaxSlider(10.0f, 100.0f)]
2020
public Vector2 var2;
2121

22-
[Label("AssetPreview", skinStyle: SkinStyle.Box)]
22+
[Label("Asset Preview", skinStyle: SkinStyle.Box)]
2323

2424
[AssetPreview]
2525
public GameObject var8;
26-
[AssetPreview(useLabel: false), Help("Who needs label?")]
27-
public GameObject var9;
2826
[AssetPreview]
2927
public Transform preview;
3028

@@ -33,12 +31,12 @@ public class SampleBehaviour1 : MonoBehaviour
3331
[Suffix("kg")]
3432
public float var10;
3533

36-
[Label("LeftToggle", skinStyle: SkinStyle.Box)]
34+
[Label("Left Toggle", skinStyle: SkinStyle.Box)]
3735

3836
[LeftToggle]
3937
public bool var12;
4038

41-
[Label("EnumToggles", skinStyle: SkinStyle.Box)]
39+
[Label("Enum Toggles", skinStyle: SkinStyle.Box)]
4240

4341
[EnumToggles]
4442
public FlagExample enumFlag = FlagExample.Flag1 | FlagExample.Flag2;
@@ -64,7 +62,7 @@ public enum FlagExample
6462
[Directory]
6563
public string directory;
6664

67-
[Label("SceneName", skinStyle: SkinStyle.Box)]
65+
[Label("Scene Name", skinStyle: SkinStyle.Box)]
6866

6967
[SceneName]
7068
public string sceneName;
@@ -76,7 +74,7 @@ public enum FlagExample
7674

7775
private readonly int[] presetValues = new[] { 1, 2, 3, 4, 5 };
7876

79-
[Label("SearchableEnum", skinStyle: SkinStyle.Box)]
77+
[Label("Searchable Enum", skinStyle: SkinStyle.Box)]
8078

8179
[SearchableEnum]
8280
public KeyCode enumSearch;
@@ -88,6 +86,9 @@ public enum FlagExample
8886

8987
[Label("Validation", skinStyle: SkinStyle.Box)]
9088

89+
[Help("NotNullAttribute, ClampAttribute, SceneObjectOnlyAttribute, ChildObjectOnlyAttribute, PrefabObjectOnlyAttribute " +
90+
"are part of group that will be re-implemented in future as ToolboxValidationAttributes. " +
91+
"Unfortunately, for now, you can't use them together with any other PropertyDrawer.", UnityMessageType.Warning)]
9192
[NotNull]
9293
public Transform var13;
9394

@@ -101,7 +102,7 @@ public enum FlagExample
101102
[PrefabObjectOnly]
102103
public GameObject prefabReference;
103104

104-
[Label("LabelByChild", skinStyle: SkinStyle.Box)]
105+
[Label("Label By Child", skinStyle: SkinStyle.Box)]
105106

106107
[LabelByChild("var3.var2")]
107108
public SampleClass1 sampleField;
@@ -123,15 +124,10 @@ public class SampleClass2
123124
public string var2;
124125
}
125126

126-
[Label("FormattedNumber", skinStyle: SkinStyle.Box)]
127+
[Label("Formatted Number", skinStyle: SkinStyle.Box)]
127128

128129
[FormattedNumber]
129130
public int bigNumber;
130131
[FormattedNumber("c")]
131132
public float currency;
132-
133-
private void OnValidate()
134-
{
135-
var9 = var8;
136-
}
137133
}

Assets/Examples/Scripts/SampleBehaviour2.cs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,16 @@ public class SampleBehaviour2 : MonoBehaviour
66
{
77
[Label("Toolbox Property Attributes", skinStyle: SkinStyle.Box, Alignment = TextAnchor.MiddleCenter, Asset = "UnityEditor.InspectorWindow")]
88

9-
[Label("ReorderableList", skinStyle: SkinStyle.Box)]
9+
[Label("Reorderable List", skinStyle: SkinStyle.Box)]
1010

11-
[ReorderableList(ListStyle.Round, elementLabel: "GameObject"), Tooltip("Sample List")]
11+
[Tooltip("Sample List")]
12+
[ReorderableList(ListStyle.Round, elementLabel: "GameObject", Foldable = true)]
1213
[InLineEditor]
1314
public GameObject[] list;
1415

16+
[ReorderableList(ListStyle.Lined, "String", true, false)]
17+
public string[] strings;
18+
1519
[ReorderableListExposed(OverrideNewElementMethodName = nameof(GetValue))]
1620
public int[] ints;
1721

@@ -20,7 +24,7 @@ public int GetValue()
2024
return ints.Length * Random.Range(1, 5);
2125
}
2226

23-
[Label("InLineEditor", skinStyle: SkinStyle.Box)]
27+
[Label("InLine Editor", skinStyle: SkinStyle.Box)]
2428

2529
[InLineEditor(DisableEditor = false)]
2630
public Transform var21;
@@ -45,12 +49,13 @@ public int GetValue()
4549
[System.Serializable]
4650
public class SampleNestedClass
4751
{
52+
[Tooltip("Set to 1")]
4853
public int i = 0;
4954
[DisableIf(nameof(i), 1), ReorderableList, TagSelector]
5055
public string[] strings;
5156
}
5257

53-
[Label("ScrollableItems", skinStyle: SkinStyle.Box)]
58+
[Label("Scrollable Items", skinStyle: SkinStyle.Box)]
5459

5560
[ScrollableItems(defaultMinIndex: 0, defaultMaxIndex: 5)]
5661
public GameObject[] largeArray = new GameObject[19];
@@ -60,7 +65,7 @@ public class SampleNestedClass
6065
[IgnoreParent]
6166
public Quaternion q;
6267

63-
[Label("Dynamic Range & MinMaxSlider", skinStyle: SkinStyle.Box)]
68+
[Label("Dynamic Range & MinMax Slider", skinStyle: SkinStyle.Box)]
6469

6570
public float a1 = -1;
6671
public float b1 = 5.5f;

Assets/Examples/Scripts/SampleBehaviour4.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System.Collections;
2+
23
using UnityEngine;
34

45
[ExecuteAlways]
@@ -82,7 +83,7 @@ private static void TestStaticMethod()
8283
public float[] floats;
8384

8485
[Label("Indentation", skinStyle: SkinStyle.Box)]
85-
86+
8687
public int var2;
8788
[BeginIndent]
8889
public int var3;
@@ -107,4 +108,14 @@ private static void TestStaticMethod()
107108

108109
[ImageArea("https://img.itch.zone/aW1nLzE5Mjc3NzUucG5n/original/Viawjm.png", 180.0f)]
109110
public int var55;
111+
112+
[Label("GUI Color", skinStyle: SkinStyle.Box)]
113+
114+
[GuiColor(1, 0, 0)]
115+
public int var56;
116+
117+
[Label("Title", skinStyle: SkinStyle.Box)]
118+
119+
[Title("Standard Title")]
120+
public int var57;
110121
}
Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
23
using UnityEngine;
34

45
[ExecuteAlways]
@@ -7,36 +8,36 @@ public class SampleBehaviour6 : MonoBehaviour
78
{
89
[SerializeReference, ReferencePicker]
910
public Interface1 var1;
10-
public ClassWithInterface var2;
11+
[SerializeReference, ReferencePicker]
12+
public ClassWithInterfaceBase var2;
1113

1214
public interface Interface1 { }
13-
public interface Interface2 : Interface1 { }
14-
public interface Interface3 : Interface1 { }
15-
public interface Interface4 : Interface2 { }
16-
public interface Interface4<T> : Interface3 { }
1715

1816
[Serializable]
1917
public struct Struct : Interface1
2018
{
21-
public int a;
19+
public bool var1;
20+
public bool var2;
2221
}
2322

23+
public abstract class ClassWithInterfaceBase : Interface1 { }
24+
2425
[Serializable]
25-
public class ClassWithInterface : Interface1
26+
public class ClassWithInterface1 : ClassWithInterfaceBase
2627
{
2728
public GameObject go;
2829
}
2930

3031
[Serializable]
31-
public class ClassWithInterface1 : Interface1
32+
public class ClassWithInterface2 : ClassWithInterfaceBase
3233
{
3334
[LeftToggle]
34-
public bool a;
35+
public bool var1;
3536
}
3637

3738
[Serializable]
38-
public class ClassWithInterface2 : Interface1
39+
public class ClassWithInterface3 : ClassWithInterfaceBase
3940
{
40-
public int i;
41+
public int var1;
4142
}
4243
}

0 commit comments

Comments
 (0)