diff --git a/Editor/Drawers/CustomObjectDrawer.cs b/Editor/Drawers/CustomObjectDrawer.cs
index 95ac69d..d253881 100644
--- a/Editor/Drawers/CustomObjectDrawer.cs
+++ b/Editor/Drawers/CustomObjectDrawer.cs
@@ -89,7 +89,10 @@ private void HandleMouseDown(Rect position, Rect positionWithoutThumb, Serialize
{
isSelected = positionWithoutThumb.Contains(Event.mousePosition);
ForceRepaintEditors();
- Clicked?.Invoke(property);
+ if (isSelected)
+ {
+ Clicked?.Invoke(property);
+ }
}
else if (Event.button == 1 && positionWithoutThumb.Contains(Event.mousePosition))
{
diff --git a/Runtime/Extensions.cs b/Runtime/Extensions.cs
index d89b03f..f832c89 100644
--- a/Runtime/Extensions.cs
+++ b/Runtime/Extensions.cs
@@ -1,4 +1,5 @@
using System.Collections.Generic;
+using System.Linq;
namespace TNRD
{
@@ -41,5 +42,21 @@ out TInterface value
{
return IsDefined(serializableInterface, out value);
}
+
+ ///
+ /// Convert a IEnumerable of Interfaces to a List of SerializableInterfaces
+ ///
+ public static List> ToSerializableInterfaceList(this IEnumerable list) where T : class
+ {
+ return list.Select(e => new SerializableInterface(e)).ToList();
+ }
+
+ ///
+ /// Convert a IEnumerable of Interfaces to an Array of SerializableInterfaces
+ ///
+ public static SerializableInterface[] ToSerializableInterfaceArray(this IEnumerable list) where T : class
+ {
+ return list.Select(e => new SerializableInterface(e)).ToArray();
+ }
}
}
diff --git a/Runtime/SerializableInterface.cs b/Runtime/SerializableInterface.cs
index a5a9224..2376d77 100644
--- a/Runtime/SerializableInterface.cs
+++ b/Runtime/SerializableInterface.cs
@@ -15,6 +15,15 @@ public class SerializableInterface : ISerializableInterface where TI
[HideInInspector, SerializeField] private UnityEngine.Object unityReference;
[SerializeReference, UsedImplicitly] private object rawReference;
+ public SerializableInterface()
+ {
+ }
+
+ public SerializableInterface(TInterface value)
+ {
+ Value = value;
+ }
+
public TInterface Value
{
get