diff --git a/Scripts/Controls/ReorderableList/ReorderableList.cs b/Scripts/Controls/ReorderableList/ReorderableList.cs index 7b3fdcf..1f0da59 100644 --- a/Scripts/Controls/ReorderableList/ReorderableList.cs +++ b/Scripts/Controls/ReorderableList/ReorderableList.cs @@ -66,6 +66,15 @@ namespace UnityEngine.UI.Extensions } return canvas; } + + /// + /// Refresh related list content + /// + public void Refresh() + { + _listContent = ContentLayout.gameObject.AddComponent(); + _listContent.Init(this); + } private void Awake() { @@ -85,8 +94,7 @@ namespace UnityEngine.UI.Extensions return; } - _listContent = ContentLayout.gameObject.AddComponent(); - _listContent.Init(this); + Refresh(); } #region Nested type: ReorderableListEventStruct diff --git a/Scripts/Controls/ReorderableList/ReorderableListElement.cs b/Scripts/Controls/ReorderableList/ReorderableListElement.cs index a0a33b9..29a4574 100644 --- a/Scripts/Controls/ReorderableList/ReorderableListElement.cs +++ b/Scripts/Controls/ReorderableList/ReorderableListElement.cs @@ -226,6 +226,10 @@ namespace UnityEngine.UI.Extensions _draggingObject.SetSiblingIndex(_fakeElement.GetSiblingIndex()); _reorderableList.OnElementAdded.Invoke(args); + + // Force refreshing both lists because otherwise we get inappropriate FromList in ReorderableListEventStruct + _reorderableList.Refresh(); + _currentReorderableListRaycasted.Refresh(); if(!isValid) throw new Exception("It's too late to cancel the Transfer! Do so in OnElementDropped!"); @@ -251,7 +255,7 @@ namespace UnityEngine.UI.Extensions } } } - + //Delete fake element if (_fakeElement != null) Destroy(_fakeElement.gameObject);