diff --git a/Alchemy/Assets/Alchemy/Editor/Elements/GenericField.cs b/Alchemy/Assets/Alchemy/Editor/Elements/GenericField.cs index 914ebb4..0c69d5c 100644 --- a/Alchemy/Assets/Alchemy/Editor/Elements/GenericField.cs +++ b/Alchemy/Assets/Alchemy/Editor/Elements/GenericField.cs @@ -103,7 +103,7 @@ namespace Alchemy.Editor.Elements else if (type == typeof(uint)) { -#if UNITY_2022_2_OR_NEWER +#if UNITY_2022_1_OR_NEWER AddField(new UnsignedIntegerField(label), (uint)obj); #else var value = (uint)obj; @@ -126,7 +126,7 @@ namespace Alchemy.Editor.Elements } else if (type == typeof(ulong)) { -#if UNITY_2022_2_OR_NEWER +#if UNITY_2022_1_OR_NEWER AddField(new UnsignedLongField(label), (ulong)obj); #else var value = (ulong)obj; diff --git a/Alchemy/Assets/Alchemy/Editor/Internal/GUIHelper.cs b/Alchemy/Assets/Alchemy/Editor/Internal/GUIHelper.cs index fec097a..ba935f3 100644 --- a/Alchemy/Assets/Alchemy/Editor/Internal/GUIHelper.cs +++ b/Alchemy/Assets/Alchemy/Editor/Internal/GUIHelper.cs @@ -82,7 +82,7 @@ namespace Alchemy.Editor if (events.OnItemsRemoved == null) return; ReflectionHelper.Invoke(target, events.OnItemsRemoved, new object[] { indices }); }; -#if UNITY_2022_2_OR_NEWER +#if UNITY_2022_1_OR_NEWER listView.itemsChosen += items => { if (events.OnItemsChosen == null) return; @@ -101,7 +101,7 @@ namespace Alchemy.Editor if (events.OnItemIndexChanged == null) return; ReflectionHelper.Invoke(target, events.OnItemIndexChanged, new object[] { before, after }); }; -#if UNITY_2022_2_OR_NEWER +#if UNITY_2022_1_OR_NEWER listView.selectionChanged += items => { if (events.OnSelectionChanged == null) return; diff --git a/Alchemy/Assets/Tests/OnListViewChangedTest.cs b/Alchemy/Assets/Tests/OnListViewChangedTest.cs index 8c6e26f..5e2599e 100644 --- a/Alchemy/Assets/Tests/OnListViewChangedTest.cs +++ b/Alchemy/Assets/Tests/OnListViewChangedTest.cs @@ -8,6 +8,8 @@ public class OnListViewChangedTest : MonoBehaviour OnItemChanged = nameof(OnItemChanged), OnItemsAdded = nameof(OnItemsAdded), OnItemsRemoved = nameof(OnItemsRemoved), + OnItemsChosen = nameof(OnItemChosen), + OnSelectionChanged = nameof(OnSelectionChanged), OnSelectedIndicesChanged = nameof(OnSelectedIndicesChanged), OnItemIndexChanged = nameof(OnItemIndexChanged)) ] @@ -28,6 +30,16 @@ public class OnListViewChangedTest : MonoBehaviour Debug.Log($"Removed: [{string.Join(',', indices)}]"); } + void OnItemChosen(IEnumerable items) + { + Debug.Log($"Chosen: [{string.Join(',', items)}]"); + } + + void OnSelectionChanged(IEnumerable items) + { + Debug.Log($"Selection Changed: [{string.Join(',', items)}]"); + } + void OnSelectedIndicesChanged(IEnumerable indices) { Debug.Log($"Selected: [{string.Join(',', indices)}]");