Skip to content

Commit a071103

Browse files
committed
Update: README.md, CHANGELOG.md; minor fixes and refactor changes
1 parent 37e7ea1 commit a071103

File tree

8 files changed

+40
-13
lines changed

8 files changed

+40
-13
lines changed

Assets/Editor Toolbox/CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@
33
### Added:
44
- Warning information if currently serialized type in TypeField-based drawers (SerializedType, [ReferencerPicker]) is not available in the filtered types collection
55
- Context menu operations for [SerializeReference] properties (Copy, Paste, Duplicate), all operations are based on a deep copy of the source reference
6-
- Basic support for generic references while using [SerializeReference] & [ReferencePicker], can be utilized in Unity 2023+
6+
- Basic support for generic references while using [SerializeReference] & [ReferencePicker], can be utilized in Unity 2023.2.x+
77
- More unit tests (PropertyUtility, filtering generic types)
88
- Validation of assigned assets in the SerializedDirectory class
99

1010
### Changed:
1111
- Fix duplicated initialization process forced by the OnValidate call
12+
- Better support for generic types for the SerializedType & associated drawer
1213
- Hierarchy: For now 'Script' label displays maximum 5 scripts
1314
- Improved types label generation for TypeField-based drawers (SerializedType, [ReferencerPicker])
1415

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
namespace Toolbox.Editor.ContextMenu.Operations
44
{
5-
internal class CopySerializedRererenceCache
5+
internal class CopySerializeReferenceCache
66
{
7-
public CopySerializedRererenceCache(Type referenceType, string data)
7+
public CopySerializeReferenceCache(Type referenceType, string data)
88
{
99
ReferenceType = referenceType;
1010
Data = data;

Assets/Editor Toolbox/Editor/ContextMenu/Operations/SerializeReference/CopySerializeReferenceOperation.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ namespace Toolbox.Editor.ContextMenu.Operations
55
{
66
internal class CopySerializeReferenceOperation : IContextMenuOperation
77
{
8-
internal static CopySerializedRererenceCache Cache { get; private set; }
8+
internal static CopySerializeReferenceCache Cache { get; private set; }
99

1010
[InitializeOnLoadMethod]
1111
private static void Initialize()
@@ -35,11 +35,11 @@ public void Perform(SerializedProperty property)
3535
{
3636
var referenceType = value.GetType();
3737
var data = JsonUtility.ToJson(value);
38-
Cache = new CopySerializedRererenceCache(referenceType, data);
38+
Cache = new CopySerializeReferenceCache(referenceType, data);
3939
return;
4040
}
4141

42-
Cache = new CopySerializedRererenceCache(null, null);
42+
Cache = new CopySerializeReferenceCache(null, null);
4343
#endif
4444
}
4545

Assets/Editor Toolbox/Editor/Internal/Types/TypeConstraintStandard.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ public TypeConstraintStandard(Type targetType, TypeSettings settings, bool allow
1616
AllowObsolete = allowObsolete;
1717
}
1818

19-
2019
public override bool IsSatisfied(Type type)
2120
{
2221
return base.IsSatisfied(type) &&
@@ -46,7 +45,6 @@ public override int GetHashCode()
4645
return hashCode;
4746
}
4847

49-
5048
public TypeSettings Settings { get; set; }
5149
public bool AllowAbstract { get; set; }
5250
public bool AllowObsolete { get; set; }

Assets/Editor Toolbox/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ Unity 2018.x or newer
3838
- Enable/disable Toolbox drawers or/and assign custom drawers
3939
- Enable/disable Toolbox Scene View and assign hotkeys
4040

41+
---
42+
> [!IMPORTANT]
43+
> This package is fully IMGUI-based, which means it may conflict with pure UI Toolkit features in your project. Additionally, Toolbox overwrites the 'base' custom Editor for all `UnityEngine.Objects`, it's a common solution but means that you can't combine other Inspector extensions/plugins.
44+
4145
## Table Of Contents
4246

4347
- [Attributes & Drawers](#drawers)
@@ -76,6 +80,10 @@ If you want to keep your custom settings between UET versions, create your own s
7680
Create/Editor Toolbox/Settings
7781
```
7882

83+
---
84+
> [!IMPORTANT]
85+
> If you are getting warnings related to the current settings state, it most likely means that some features are not present in your Unity version. I suggest creating your own settings file and adjusting potential issues. Generally, it's always better to use a custom settings file rather than the default one. I'm planning to replace the ScriptableObject-based solution in the future, so it won't be a problem anymore.
86+
7987
## Attributes & Drawers <a name="drawers"></a>
8088

8189
### Regular Drawers <a name="regulardrawers"></a>

Assets/Editor Toolbox/Tests/Editor/TypesFilteringTest.cs

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
#pragma warning disable CS0612
22

3-
using NUnit.Framework;
4-
53
using System;
6-
4+
using NUnit.Framework;
75
using UnityEngine;
86

97
namespace Toolbox.Editor.Tests
@@ -21,6 +19,8 @@ public interface Interface4<T> : Interface3 { }
2119
public interface Interface5 : Interface4<int> { }
2220
public interface Interface6 : Interface4<string> { }
2321
public interface Interface7<T> : Interface4<T> { }
22+
public interface Interface8<T1, T2> : Interface4<T1> { }
23+
public interface Interface9 : Interface8<int, int> { }
2424

2525
public abstract class ClassBase : Interface1 { }
2626

@@ -32,6 +32,8 @@ public class ClassWithInterface4<T> : ClassBase, Interface4<T> { }
3232
public class ClassWithInterface5 : ClassWithInterface4<int> { }
3333
public class ClassWithInterface6 : ClassWithInterface4<string> { }
3434
public class ClassWithInterface7<T> : ClassWithInterface4<T> { }
35+
public class ClassWithInterface8<T1, T2> : ClassWithInterface4<T1> { }
36+
public class ClassWithInterface9 : ClassWithInterface8<int, int> { }
3537

3638
[TestCase(typeof(ClassBase), 3)]
3739
[TestCase(typeof(Interface1), 6)]
@@ -148,6 +150,12 @@ public void TestStandardConstraintWithGenericPass()
148150
Assert.IsTrue(collection.Contains(typeof(Interface5)));
149151
Assert.IsFalse(collection.Contains(typeof(Interface6)));
150152
Assert.IsTrue(collection.Contains(typeof(Interface7<int>)));
153+
Assert.IsFalse(collection.Contains(typeof(Interface8<string, string>)));
154+
Assert.IsTrue(collection.Contains(typeof(Interface9)));
155+
156+
//NOTE: not supported since the 2nd argument should be "picked", we don't want to generate all available options
157+
Assert.IsFalse(collection.Contains(typeof(Interface8<int, int>)));
158+
Assert.IsFalse(collection.Contains(typeof(Interface8<int, string>)));
151159
}
152160

153161
[Test]
@@ -199,13 +207,17 @@ public void TestSerializeReferenceConstraintWithGenericPass()
199207
Assert.IsTrue(collection.Contains(typeof(ClassWithInterface5)));
200208
Assert.IsFalse(collection.Contains(typeof(ClassWithInterface6)));
201209
Assert.IsFalse(collection.Contains(typeof(ClassWithInterface7<string>)));
210+
Assert.IsTrue(collection.Contains(typeof(ClassWithInterface9)));
202211
#if UNITY_2023_2_OR_NEWER
203-
Assert.IsTrue(collection.Contains(typeof(ClassWithInterface7<int>)));
204212
Assert.IsTrue(collection.Contains(typeof(ClassWithInterface4<int>)));
213+
Assert.IsTrue(collection.Contains(typeof(ClassWithInterface7<int>)));
205214
#else
206-
Assert.IsFalse(collection.Contains(typeof(ClassWithInterface7<int>)));
207215
Assert.IsFalse(collection.Contains(typeof(ClassWithInterface4<int>)));
216+
Assert.IsFalse(collection.Contains(typeof(ClassWithInterface7<int>)));
208217
#endif
218+
219+
//NOTE: not supported since the 2nd argument should be "picked", we don't want to generate all available options
220+
Assert.IsFalse(collection.Contains(typeof(ClassWithInterface8<int, int>)));
209221
}
210222
}
211223
}

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ Unity 2018.x or newer
3838
- Enable/disable Toolbox drawers or/and assign custom drawers
3939
- Enable/disable Toolbox Scene View and assign hotkeys
4040

41+
---
42+
> [!IMPORTANT]
43+
> This package is fully IMGUI-based, which means it may conflict with pure UI Toolkit features in your project. Additionally, Toolbox overwrites the 'base' custom Editor for all `UnityEngine.Objects`, it's a common solution but means that you can't combine other Inspector extensions/plugins.
44+
4145
## Table Of Contents
4246

4347
- [Attributes & Drawers](#drawers)
@@ -76,6 +80,10 @@ If you want to keep your custom settings between UET versions, create your own s
7680
Create/Editor Toolbox/Settings
7781
```
7882

83+
---
84+
> [!IMPORTANT]
85+
> If you are getting warnings related to the current settings state, it most likely means that some features are not present in your Unity version. I suggest creating your own settings file and adjusting potential issues. Generally, it's always better to use a custom settings file rather than the default one. I'm planning to replace the ScriptableObject-based solution in the future, so it won't be a problem anymore.
86+
7987
## Attributes & Drawers <a name="drawers"></a>
8088

8189
### Regular Drawers <a name="regulardrawers"></a>

0 commit comments

Comments
 (0)