Skip to content

Commit 84c4777

Browse files
committed
Update documentation
1 parent dc6cb77 commit 84c4777

1 file changed

Lines changed: 112 additions & 24 deletions

File tree

README.md

Lines changed: 112 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,13 @@ Unity 2018.x or newer
3636
- [Attributes & Drawers](#drawers)
3737
- [Regular Drawers](#regulardrawers)
3838
- [Toolbox Drawers](#toolboxdrawers)
39+
- [Toolbox Decorator Attributes](#toolboxdecorator)
40+
- [Toolbox Condition Attributes](#toolboxcondition)
41+
- [Toolbox Property (Self/List) Attributes](#toolboxproperty)
42+
- [Toolbox Special Attributes](#toolboxspecial)
43+
- [Toolbox Archetype Attributes](#toolboxarchetype)
44+
- [SerializeReference (ReferencePicker)](#toolboxserializereference)
45+
- [Toolbox Custom Editors](#toolboxeditors)
3946
- [Material Drawers](#materialdrawers)
4047
- [Serialized Types](#serialized-types)
4148
- [Editor Extensions](#editor-extensions)
@@ -46,7 +53,7 @@ Unity 2018.x or newer
4653

4754
## Settings
4855

49-
The most important file, it allows the user to manage all available features. Can be accessed from the Project Settings window (Edit/Project Settings.../Editor Toolbox) or directly inside the Project window. Make sure to have one valid settings file per project.
56+
The most important file, allows the user to manage all available features. Can be accessed from the Project Settings window (Edit/Project Settings.../Editor Toolbox) or directly inside the Project window. Make sure to have one valid settings file per project.
5057

5158
Available features are divided into three groups:
5259
- Hierarchy
@@ -55,6 +62,9 @@ Available features are divided into three groups:
5562

5663
Each module is described in its respective section.
5764

65+
If you want to keep your custom settings between UET versions, create your own settings file:
66+
```Create/Editor Toolbox/Settings```
67+
5868
## Attributes & Drawers <a name="drawers"></a>
5969

6070
### Regular Drawers <a name="regulardrawers"></a>
@@ -80,17 +90,6 @@ public float var1 = 80.0f;
8090
![inspector](https://github.com/arimger/Unity-Editor-Toolbox/blob/develop/Docs/progressbar1.png)\
8191
![inspector](https://github.com/arimger/Unity-Editor-Toolbox/blob/develop/Docs/progressbar2.png)
8292

83-
#### NewLabelAttribute
84-
85-
```csharp
86-
[NewLabel("Custom Label", "Element")]
87-
public int[] vars1 = new int[3];
88-
[NewLabel("Custom Label")]
89-
public float var2 = 25.4f;
90-
```
91-
92-
![inspector](https://github.com/arimger/Unity-Editor-Toolbox/blob/develop/Docs/newlabel.png)
93-
9493
#### MinMaxSliderAttribute
9594

9695
```csharp
@@ -111,10 +110,6 @@ public Component var2;
111110

112111
![inspector](https://github.com/arimger/Unity-Editor-Toolbox/blob/develop/Docs/assetpreview.png)
113112

114-
#### HideLabelAttribute
115-
116-
![inspector](https://github.com/arimger/Unity-Editor-Toolbox/blob/develop/Docs/hidelabel.png)
117-
118113
#### SuffixAttribute
119114

120115
![inspector](https://github.com/arimger/Unity-Editor-Toolbox/blob/develop/Docs/suffix.png)
@@ -254,7 +249,7 @@ Examples **'How to'** create custom ToolboxDrawers you can find [HERE](https://g
254249

255250
![inspector](https://github.com/arimger/Unity-Editor-Toolbox/blob/develop/Docs/inspector.png)
256251

257-
#### ToolboxDecoratorAttributes
252+
#### Toolbox Decorator Attributes <a name="toolboxdecorator"></a>
258253

259254
Display/create something before and after property in the desired order (using Order property).
260255
In fact **ToolboxDecoratorDrawers** are like extended version of built-in **DecoratorDrawers**.
@@ -336,7 +331,7 @@ public int var1;
336331

337332
![inspector](https://github.com/arimger/Unity-Editor-Toolbox/blob/develop/Docs/button.png)
338333

339-
#### ToolboxConditionAttributes
334+
#### Toolbox Condition Attributes <a name="toolboxcondition"></a>
340335

341336
Enable/disable or show/hide properties using custom conditions. You can use them together with any other type of drawer.
342337
Every ToolboxConditionDrawer supports boolean, int, string, UnityEngine.Object and enum types and works even with array/list properties.
@@ -387,7 +382,9 @@ public int[] vars1 = new [] { 1, 2, 3, 4 };
387382
![inspector](https://github.com/arimger/Unity-Editor-Toolbox/blob/develop/Docs/enableif1.png)\
388383
![inspector](https://github.com/arimger/Unity-Editor-Toolbox/blob/develop/Docs/enableif2.png)
389384

390-
#### InLineEditorAttribute
385+
#### Toolbox Property Attributes <a name="toolboxproperty"></a>
386+
387+
##### InLineEditorAttribute
391388

392389
This attribute gives a great possibility to extend all reference-related (UnityEngine.Object) fields.
393390
Using it you are able to 'inline' Editors for: components, ScriptableObjects, Materials, Renderers, MeshFilters, Textures, AudioClips, etc.
@@ -408,7 +405,7 @@ public Material var1;
408405
```
409406
![inspector](https://github.com/arimger/Unity-Editor-Toolbox/blob/develop/Docs/inlined1.png)
410407

411-
#### Reorderable List
408+
##### Reorderable List
412409

413410
Custom implementation of standard ReorderableList (UnityEditorInternal). Usable as an attribute in serialized fields or a single object in custom Editors.
414411

@@ -447,7 +444,7 @@ private int GetValue()
447444
}
448445
```
449446

450-
#### ScrollableItemsAttribute
447+
##### ScrollableItemsAttribute
451448

452449
It's a perfect solution to inspect large arrays/lists and optimize displaying them within the Inspector window.
453450

@@ -458,7 +455,7 @@ public GameObject[] largeArray = new GameObject[19];
458455

459456
![inspector](https://github.com/arimger/Unity-Editor-Toolbox/blob/develop/Docs/scrollableitems.png)
460457

461-
#### Other ToolboxProperty attributes
458+
##### Other ToolboxProperty attributes
462459

463460
```csharp
464461
[IgnoreParent]
@@ -473,7 +470,23 @@ public float minValue;
473470
public float MaxValue => 15.0f;
474471
```
475472

476-
#### ToolboxArchetypeAttributes
473+
#### Toolbox Special Attributes <a name="toolboxspecial"></a>
474+
475+
Attributes handled internally by the ToolboxEditor. You can combine them with any other attributes.
476+
477+
```csharp
478+
[NewLabel("Custom Label")]
479+
public float var1 = 25.4f;
480+
```
481+
482+
```csharp
483+
[HideLabel]
484+
public float var1;
485+
```
486+
487+
![inspector](https://github.com/arimger/Unity-Editor-Toolbox/blob/develop/Docs/hidelabel.png)
488+
489+
#### Toolbox Archetype Attributes <a name="toolboxarchetype"></a>
477490

478491
Using this attribute you are able to implement custom patterns of frequently grouped **ToolboxAttributes**.
479492

@@ -512,6 +525,81 @@ public int var1;
512525

513526
![inspector](https://github.com/arimger/Unity-Editor-Toolbox/blob/develop/Docs/title.png)
514527

528+
#### SerializeReference (ReferencePicker) <a name="toolboxserializereference></a>
529+
530+
You can draw properties marked with the [SerializeReference] attribute with an additional type picker that allows you to manipulate what managed type will be serialized.
531+
532+
```csharp
533+
[SerializeReference, ReferencePicker]
534+
public Interface1 var1;
535+
[SerializeReference, ReferencePicker]
536+
public ClassWithInterfaceBase var2;
537+
538+
public interface Interface1 { }
539+
540+
[Serializable]
541+
public struct Struct : Interface1
542+
{
543+
public bool var1;
544+
public bool var2;
545+
}
546+
547+
public abstract class ClassWithInterfaceBase : Interface1 { }
548+
549+
[Serializable]
550+
public class ClassWithInterface1 : ClassWithInterfaceBase
551+
{
552+
public GameObject go;
553+
}
554+
555+
[Serializable]
556+
public class ClassWithInterface2 : ClassWithInterfaceBase
557+
{
558+
[LeftToggle]
559+
public bool var1;
560+
}
561+
562+
[Serializable]
563+
public class ClassWithInterface3 : ClassWithInterfaceBase
564+
{
565+
public int var1;
566+
}
567+
```
568+
569+
![inspector](https://github.com/arimger/Unity-Editor-Toolbox/blob/develop/Docs/referencepicker.png)
570+
571+
#### Custom Editors <a name="toolboxeditors"></a>
572+
573+
If you want to create a custom **UnityEditor.Editor** for your components and still use Toolbox-related features be sure to inherit from the **Toolbox.Editor.ToolboxEditor** class.
574+
575+
```csharp
576+
using UnityEditor;
577+
using UnityEngine;
578+
#if UNITY_2019_1_OR_NEWER
579+
using UnityEditor.UIElements;
580+
using UnityEngine.UIElements;
581+
#endif
582+
using Toolbox.Editor;
583+
584+
[CustomEditor(typeof(SampleBehaviour))]
585+
public class SampleEditor : ToolboxEditor
586+
{
587+
private void OnEnable()
588+
{ }
589+
590+
private void OnDisable()
591+
{ }
592+
593+
public override void DrawCustomInspector()
594+
{
595+
base.DrawCustomInspector();
596+
597+
//for custom properties:
598+
// - ToolboxEditorGui.DrawToolboxProperty(serializedObject.FindProperty("myProperty"));
599+
}
600+
}
601+
```
602+
515603
### Material Drawers <a name="materialdrawers"></a>
516604

517605
```
@@ -547,7 +635,7 @@ _HideIfExample ("Range", Range(0, 1)) = 0.75
547635
Allows to serialize Types and pick them through a dedicated picker.
548636

549637
```csharp
550-
[ClassExtends(typeof(Collider), Grouping = ClassGrouping.None, AddTextSearchField = false)] //or [ClassImplements(typeof(interface))] for interfaces
638+
[TypeConstraint(typeof(Collider), AllowAbstract = false, AllowObsolete = false, TypeSettings = TypeSettings.Class, TypeGrouping = TypeGrouping.None)]
551639
public SerializedType var1;
552640

553641
public void Usage()

0 commit comments

Comments
 (0)