Skip to content

Commit

Permalink
Update: README.md, CHANGELOG.md & samples
Browse files Browse the repository at this point in the history
  • Loading branch information
arimger committed Aug 28, 2024
1 parent eab215d commit e2c6d98
Show file tree
Hide file tree
Showing 8 changed files with 140 additions and 53 deletions.
45 changes: 29 additions & 16 deletions Assets/Editor Toolbox/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,39 @@
## 0.13.0 [28.08.2024]

### Added:
- Warning information if currently serialized type in TypeField-based drawers (SerializedType, [ReferencerPicker]) is not available in the filtered types collection
- Context menu operations for [SerializeReference] properties (Copy, Paste, Duplicate), all operations are based on a deep copy of the source reference
- Basic support for generic references while using [SerializeReference] & [ReferencePicker], can be utilized in Unity 2023+
- More unit tests (PropertyUtility, filtering generic types)

### Changed:
- Fix duplicated initialization process forced by the OnValidate call
- Hierarchy: For now 'Script' label displays maximum 5 scripts
- Improved types label generation for TypeField-based drawers (SerializedType, [ReferencerPicker])

## 0.12.13 [22.08.2024]

### Added:
- DisableInEditModeAttribute

### Changed:
- Hierarchy: Added Tree List renderer, which improves visual identification of parent and child gameobjects
- Hierarchy: For now 'Script' label will display all available components linked to a GameObject/Prefabs
- Hierarchy: For now 'Layer' label will display full layer name instead of the layer mask value
- Fix SceneView settings change events firing when they shouldn't
- Fix issue when trying to find private fields/properties from parent classes (e.g. while using conditional attributes)

### Added:
- DisableInEditModeAttribute

## 0.12.12 [17.06.2024]

### Added:
- NotPrefabObjectOnlyAttribute

### Changed:
- LabelWidthAttribute is now part of the Toolbox decorator attributes (can be mixed with other attributes)
- Hierarchy: Script, Tag, and Layer columns are now excluded from the default settings
- Possibility to change style for groups ([BeginGroup] and [BeginHorizontalGroup] attributes)
- ScriptableObject Creation Wizard now accepts only ScriptableObjects marked with the [CreateInWizard] or [CreateAssetMenu] attributes

### Added:
- NotPrefabObjectOnlyAttribute

## 0.12.11 [05.04.2024]

### Changed:
Expand Down Expand Up @@ -53,13 +66,13 @@

## 0.12.7 [10.12.2023]

### Added:
- 'Revert Prefab Name' option for prefabs in the GameObject/Prefabs context menu

### Changed:
- Possibility to interact with ProgressBarDrawer (added IsInteractable property to the ProgressBarAttribute)
- MinMaxAttribute now supports Vector2Int

### Added:
- 'Revert Prefab Name' option for prefabs in the GameObject/Prefabs context menu

## 0.12.6 [19.10.2023]

### Changed:
Expand All @@ -68,12 +81,12 @@

## 0.12.5 [11.09.2023]

### Changed:
- Make ToolboxEditorHandler public

### Added:
- Add public OnCacheRefreshed event to the SceneSerializationUtility

### Changed:
- Make ToolboxEditorHandler public

## 0.12.4 [31.07.2023]

### Changed:
Expand All @@ -85,16 +98,16 @@

## 0.12.3 [17.06.2023]

### Added:
- SceneView extension: better way to select raycasted objects in the Scene view
- LabelWidthAttribute

### Changed:
- Fix updating SerializedScene index after deleting Scene
- Fix SerializedScene index calculation
- Fix NRE when deleted Scene was still included in Build Settings
- Fix compilation errors in Unity 2018.x

### Added:
- SceneView extension: better way to select raycasted objects in the Scene view
- LabelWidthAttribute

## 0.12.1 [12.04.2023]

### Changed:
Expand Down
83 changes: 67 additions & 16 deletions Assets/Editor Toolbox/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ Unity 2018.x or newer
- [Hierarchy](#hierarchy)
- [Project](#project)
- [Toolbar](#toolbar)
- [Utilities](#utilities)
- [SceneView](#sceneview)
- [Utilities](#utilities)

## Settings

Expand Down Expand Up @@ -655,22 +655,22 @@ To prevent issues after renaming types use `UnityEngine.Scripting.APIUpdating.Mo

```csharp
[SerializeReference, ReferencePicker(TypeGrouping = TypeGrouping.ByFlatName)]
public Interface1 var1;
public ISampleInterface var1;
[SerializeReference, ReferencePicker(ForceUninitializedInstance = true)]
public Interface1 var1;
public ISampleInterface var1;
[SerializeReference, ReferencePicker(ParentType = typeof(ClassWithInterface2)]
public ClassWithInterfaceBase var2;

public interface Interface1 { }
public interface ISampleInterface { }

[Serializable]
public struct Struct : Interface1
public struct Struct : ISampleInterface
{
public bool var1;
public bool var2;
}

public abstract class ClassWithInterfaceBase : Interface1 { }
public abstract class ClassWithInterfaceBase : ISampleInterface { }

[Serializable]
public class ClassWithInterface1 : ClassWithInterfaceBase
Expand All @@ -694,6 +694,47 @@ public class ClassWithInterface3 : ClassWithInterfaceBase

![inspector](https://github.com/arimger/Unity-Editor-Toolbox/blob/develop/Docs/referencepicker.png)
##### SerializeReference generics support

Unity 2023.x introduced support for serializing generic references.
In this case you can serialize generic types or use generics as a base class for your references.
**ReferencePicker** will automatically create all available generic types if the generic definition satisfies the constraints.

```csharp
#if UNITY_2023_2_OR_NEWER
[SerializeReference, ReferencePicker(TypeGrouping = TypeGrouping.None)]
public IGenericInterface<string> genericString;
[SerializeReference, ReferencePicker(TypeGrouping = TypeGrouping.None)]
public IGenericInterface<int> genericInt;
[SerializeReference, ReferencePicker(TypeGrouping = TypeGrouping.None)]
public IGenericInterface<bool> genericBool;

public interface IGenericInterface<TValue>
{
TValue Value { get; }
}

public class GenericInterfaceImplementation<TValue> : IGenericInterface<TValue>
{
[SerializeField]
private TValue value;

public TValue Value => value;
}
#endif
```

![inspector](https://github.com/arimger/Unity-Editor-Toolbox/blob/develop/Docs/serializereferencegenerics.png)
##### SerializeReference context menu operations

You can use few custom context menu operations for the SerializeReference-based fields:
- **Copy Serialize Reference**: creates a deep copy of the linked reference
- **Paste Serialize Reference**: allows to paste preserved copy to a field
- **Duplicate Serialize Reference**: allows to duplicate the linked reference (works only on collection elements)

![inspector](https://github.com/arimger/Unity-Editor-Toolbox/blob/develop/Docs/serializereferenceoperations.png)
#### Custom Editors <a name="toolboxeditors"></a>

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.
Expand Down Expand Up @@ -727,9 +768,9 @@ public class SampleEditor : ToolboxEditor
}
```

##### Custom Editor Implementation
- **Toolbox.Editor.ToolboxEditor** - default class, override it if you want to implement a custom Editor for your components and ScriptableObjects
- **Toolbox.Editor.ToolboxScriptedImporterEditor** - override it if you want to implement a custom Editor for your custom importers
##### Custom Editor Implementations
- **Toolbox.Editor.ToolboxEditor**: default class, override it if you want to implement a custom Editor for your components and ScriptableObjects
- **Toolbox.Editor.ToolboxScriptedImporterEditor**: override it if you want to implement a custom Editor for your custom importers

### Material Drawers <a name="materialdrawers"></a>

Expand Down Expand Up @@ -832,10 +873,14 @@ public void Usage()

Allows to serialize DateTime.

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

Allows to serialize folders in form of assets and retrieve direct paths in runtime.

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

### Hierarchy <a name="hierarchy"></a>
Expand Down Expand Up @@ -916,23 +961,29 @@ public static class MyEditorUtility

![inspector](https://github.com/arimger/Unity-Editor-Toolbox/blob/develop/Docs/toolbar.png)
### SceneView <a name="sceneview"></a>

Select a specific object that is under the cursor (default key: tab).

![inspector](https://github.com/arimger/Unity-Editor-Toolbox/blob/develop/Docs/sceneview.png)
### Utilities <a name="utilities"></a>

In this section you will find various extensions that don't fit into a specific category.

#### Context Menu operations

Copy and paste all components from/to particular GameObject.

![inspector](https://github.com/arimger/Unity-Editor-Toolbox/blob/develop/Docs/utils.png)
#### ScriptableObject Creation Wizard

Create multiple ScriptableObjects at once.
Wizard will allow only ScritpableObjects marked with **[Toolbox.Attributes.CreateInWizard]** or **[UnityEngine.CreateAssetMenu]** attributes.

```
Assets/Create/Editor Toolbox/ScriptableObject Creation Wizard
```

![inspector](https://github.com/arimger/Unity-Editor-Toolbox/blob/develop/Docs/createso.png)
### SceneView <a name="sceneview"></a>

Select a specific object that is under the cursor (default key: tab).

![inspector](https://github.com/arimger/Unity-Editor-Toolbox/blob/develop/Docs/sceneview.png)
![inspector](https://github.com/arimger/Unity-Editor-Toolbox/blob/develop/Docs/createso.png)
2 changes: 1 addition & 1 deletion Assets/Editor Toolbox/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "com.browar.editor-toolbox",
"displayName": "Editor Toolbox",
"version": "0.12.13",
"version": "0.13.0",
"unity": "2018.1",
"description": "Tools, custom attributes, drawers, hierarchy overlay, and other extensions for the Unity Editor.",
"keywords": [
Expand Down
3 changes: 3 additions & 0 deletions Assets/Examples/Scenes/SampleScene.unity
Original file line number Diff line number Diff line change
Expand Up @@ -1819,6 +1819,9 @@ MonoBehaviour:
error: 0
date:
ticks: 637820719200000000
directory:
directoryAsset: {fileID: 102900000, guid: 6c5a542f2ff6e87499c1a85957eafd9e, type: 3}
path: Assets/Editor Toolbox
--- !u!1 &1221313406
GameObject:
m_ObjectHideFlags: 0
Expand Down
6 changes: 5 additions & 1 deletion Assets/Examples/Scripts/SampleBehaviour5.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class SampleBehaviour5 : MonoBehaviour
public SerializedType type4;
[TypeConstraint(typeof(Collider), AllowAbstract = true, AllowObsolete = false, TypeSettings = TypeSettings.Class, TypeGrouping = TypeGrouping.ByFlatName)]
public SerializedType type5;
[TypeConstraint(typeof(ISampleGenericInterface<int>), AllowAbstract = false, AllowObsolete = false, TypeSettings = TypeSettings.Class, TypeGrouping = TypeGrouping.ByFlatName)]
[TypeConstraint(typeof(ISampleGenericInterface<>), AllowAbstract = false, AllowObsolete = false, TypeSettings = TypeSettings.Class, TypeGrouping = TypeGrouping.ByFlatName)]
public SerializedType type6;

public interface ISampleGenericInterface<T> { }
Expand All @@ -41,4 +41,8 @@ public class ClassWithInterface3<T> : ISampleGenericInterface<bool> { }
[Label("Serialized DateTime", skinStyle: SkinStyle.Box)]

public SerializedDateTime date;

[Label("Serialized Directory", skinStyle: SkinStyle.Box)]

public SerializedDirectory directory;
}
Binary file added Docs/serializeddate.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Docs/serializedirectory.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit e2c6d98

Please sign in to comment.