diff --git a/src/ExplorerCore.cs b/src/ExplorerCore.cs index faa13ac..7a7ecd0 100644 --- a/src/ExplorerCore.cs +++ b/src/ExplorerCore.cs @@ -7,6 +7,7 @@ using UnityExplorer.Core.Config; using UnityExplorer.Core.Input; using UnityExplorer.Core.Runtime; using UnityExplorer.UI; +using UnityExplorer.UI.Panels; namespace UnityExplorer { diff --git a/src/UI/Panels/InspectorTest.cs b/src/UI/Panels/InspectorTest.cs index 7da70f1..b64f160 100644 --- a/src/UI/Panels/InspectorTest.cs +++ b/src/UI/Panels/InspectorTest.cs @@ -34,28 +34,6 @@ namespace UnityExplorer.UI.Panels ConfigManager.GameObjectInspectorData.Value = this.ToSaveData(); } - public override void OnFinishResize(RectTransform panel) - { - base.OnFinishResize(panel); - RuntimeProvider.Instance.StartCoroutine(DelayedRefresh(panel)); - } - - private float previousRectHeight; - - private IEnumerator DelayedRefresh(RectTransform obj) - { - yield return null; - - if (obj.rect.height != previousRectHeight) - { - // height changed, hard refresh required. - previousRectHeight = obj.rect.height; - //scrollPool.ReloadData(); - } - - scrollPool.RefreshCells(true); - } - public override void SetDefaultPosAndAnchors() { mainPanelRect.localPosition = Vector2.zero; @@ -68,6 +46,8 @@ namespace UnityExplorer.UI.Panels mainPanelRect.anchoredPosition = new Vector2(-150, 0); } + internal static DynamicListTest listInstance; + private ScrollPool scrollPool; public override void ConstructPanelContent() @@ -83,32 +63,33 @@ namespace UnityExplorer.UI.Panels //scrollPool.Viewport.GetComponent().enabled = false; //scrollPool.Content.gameObject.AddComponent().color = new Color(1f, 0f, 1f, 0.3f); - var test = new DynamicListTest(scrollPool, this); - test.Init(); + listInstance = new DynamicListTest(scrollPool, this); + listInstance.Init(); //var prototype = DynamicCell.CreatePrototypeCell(scrollContent); //scrollPool.PrototypeCell = prototype.GetComponent(); - dummyContentHolder = new GameObject("DummyHolder"); - dummyContentHolder.SetActive(false); + contentHolder = new GameObject("DummyHolder"); + contentHolder.SetActive(false); + contentHolder.transform.SetParent(this.content.transform, false); - GameObject.DontDestroyOnLoad(dummyContentHolder); + GameObject.DontDestroyOnLoad(contentHolder); ExplorerCore.Log("Creating dummy objects"); - for (int i = 0; i < 100; i++) + for (int i = 0; i < 10; i++) { dummyContents.Add(CreateDummyContent()); } ExplorerCore.Log("Done"); - previousRectHeight = mainPanelRect.rect.height; + //previousRectHeight = mainPanelRect.rect.height; } - internal GameObject dummyContentHolder; + internal GameObject contentHolder; internal readonly List dummyContents = new List(); private GameObject CreateDummyContent() { - var obj = UIFactory.CreateVerticalGroup(dummyContentHolder, "Content", true, true, true, true, 2, new Vector4(2, 2, 2, 2)); + var obj = UIFactory.CreateVerticalGroup(contentHolder, "Content", true, true, true, true, 2, new Vector4(2, 2, 2, 2)); obj.AddComponent().verticalFit = ContentSizeFitter.FitMode.PreferredSize; var horiGroup = UIFactory.CreateHorizontalGroup(obj, "topGroup", true, true, true, true); @@ -157,29 +138,76 @@ namespace UnityExplorer.UI.Panels public class DynamicListTest : IPoolDataSource { - internal ScrollPool Scroller; + internal ScrollPool ScrollPool; internal InspectorTest Inspector; public DynamicListTest(ScrollPool scroller, InspectorTest inspector) { - Scroller = scroller; + ScrollPool = scroller; Inspector = inspector; } - public int ItemCount => Inspector.dummyContents.Count; + public int ItemCount => filtering ? filteredIndices.Count : Inspector.dummyContents.Count; + + private bool filtering; + private readonly List filteredIndices = new List(); + + public int GetRealIndexOfTempIndex(int index) + { + if (index < 0 || index >= filteredIndices.Count) + return -1; + return filteredIndices[index]; + } + + public void ToggleFilter() + { + if (filtering) + { + DisableFilter(); + ScrollPool.DisableTempCache(); + } + else + { + EnableRandomFilter(); + ScrollPool.EnableTempCache(); + } + + ExplorerCore.Log("Filter toggled, new count: " + ItemCount); + ScrollPool.Rebuild(); + } + + public void EnableRandomFilter() + { + filteredIndices.Clear(); + filtering = true; + + int counter = UnityEngine.Random.Range(0, Inspector.dummyContents.Count); + while (filteredIndices.Count < counter) + { + var i = UnityEngine.Random.Range(0, Inspector.dummyContents.Count); + if (!filteredIndices.Contains(i)) + filteredIndices.Add(i); + } + filteredIndices.Sort(); + } + + public void DisableFilter() + { + filtering = false; + } public void OnDisableCell(CellViewHolder cell, int dataIndex) { if (cell.UIRoot.transform.Find("Content") is Transform existing) - existing.transform.SetParent(Inspector.dummyContentHolder.transform, false); + existing.transform.SetParent(Inspector.contentHolder.transform, false); } public void Init() { - var prototype = CellViewHolder.CreatePrototypeCell(Scroller.UIRoot); + var prototype = CellViewHolder.CreatePrototypeCell(ScrollPool.UIRoot); - Scroller.DataSource = this; - Scroller.Initialize(this, prototype); + ScrollPool.DataSource = this; + ScrollPool.Initialize(this, prototype); } public ICell CreateCell(RectTransform cellTransform) => new CellViewHolder(cellTransform.gameObject); @@ -202,6 +230,9 @@ namespace UnityExplorer.UI.Panels return; } + if (filtering) + index = GetRealIndexOfTempIndex(index); + var content = Inspector.dummyContents[index]; if (content.transform.parent.ReferenceEqual(root.transform)) @@ -215,7 +246,7 @@ namespace UnityExplorer.UI.Panels private void DisableContent(GameObject cellRoot) { if (cellRoot.transform.Find("Content") is Transform existing) - existing.transform.SetParent(Inspector.dummyContentHolder.transform, false); + existing.transform.SetParent(Inspector.contentHolder.transform, false); } } } diff --git a/src/UI/Panels/SceneExplorer.cs b/src/UI/Panels/SceneExplorer.cs index 722e374..6b59842 100644 --- a/src/UI/Panels/SceneExplorer.cs +++ b/src/UI/Panels/SceneExplorer.cs @@ -125,7 +125,7 @@ namespace UnityExplorer.UI.Panels private void OnFilterInput(string input) { Tree.CurrentFilter = input; - Tree.RefreshData(true); + Tree.RefreshData(true, true); } //private float highestRectHeight; @@ -220,14 +220,17 @@ namespace UnityExplorer.UI.Panels // Transform Tree - var infiniteScroll = UIFactory.CreateScrollPool(content, "TransformTree", out GameObject scrollObj, + var scrollPool = UIFactory.CreateScrollPool(content, "TransformTree", out GameObject scrollObj, out GameObject scrollContent, new Color(0.15f, 0.15f, 0.15f)); UIFactory.SetLayoutElement(scrollObj, flexibleHeight: 9999); UIFactory.SetLayoutElement(scrollContent, flexibleHeight: 9999); - Tree = new TransformTree(infiniteScroll) { GetRootEntriesMethod = GetRootEntries }; + Tree = new TransformTree(scrollPool) { GetRootEntriesMethod = GetRootEntries }; Tree.Init(); + //scrollPool.Viewport.GetComponent().enabled = false; + //UIRoot.GetComponent().enabled = false; + // Scene Loader ConstructSceneLoader(); diff --git a/src/UI/UIManager.cs b/src/UI/UIManager.cs index 1c6b9d1..739c493 100644 --- a/src/UI/UIManager.cs +++ b/src/UI/UIManager.cs @@ -22,7 +22,7 @@ namespace UnityExplorer.UI // panels public static SceneExplorer SceneExplorer { get; private set; } - public static InspectorTest GOInspector { get; private set; } + public static InspectorTest Inspector { get; private set; } // bundle assets internal static Font ConsoleFont { get; private set; } @@ -54,8 +54,8 @@ namespace UnityExplorer.UI SceneExplorer = new SceneExplorer(); SceneExplorer.ConstructUI(CanvasRoot); - GOInspector = new InspectorTest(); - GOInspector.ConstructUI(CanvasRoot); + Inspector = new InspectorTest(); + Inspector.ConstructUI(CanvasRoot); //MainMenu.Create(); //InspectUnderMouse.ConstructUI(); diff --git a/src/UI/Widgets/ButtonList/ButtonListSource.cs b/src/UI/Widgets/ButtonList/ButtonListSource.cs index da27f5d..9a536d6 100644 --- a/src/UI/Widgets/ButtonList/ButtonListSource.cs +++ b/src/UI/Widgets/ButtonList/ButtonListSource.cs @@ -11,6 +11,8 @@ namespace UnityExplorer.UI.Widgets { public class ButtonListSource : IPoolDataSource { + public int GetRealIndexOfTempIndex(int index) => throw new NotImplementedException("TODO"); + internal ScrollPool Scroller; public int ItemCount => currentEntries.Count; diff --git a/src/UI/Widgets/ScrollPool/DataHeightManager.cs b/src/UI/Widgets/ScrollPool/DataHeightCache.cs similarity index 79% rename from src/UI/Widgets/ScrollPool/DataHeightManager.cs rename to src/UI/Widgets/ScrollPool/DataHeightCache.cs index 1eb0b4c..ecce5de 100644 --- a/src/UI/Widgets/ScrollPool/DataHeightManager.cs +++ b/src/UI/Widgets/ScrollPool/DataHeightCache.cs @@ -11,18 +11,27 @@ namespace UnityExplorer.UI.Widgets public float height, startPosition; public int normalizedSpread; - public static implicit operator float(DataViewInfo ch) => ch.height; + public static implicit operator float(DataViewInfo it) => it.height; } - public class DataHeightManager + public class DataHeightCache { private ScrollPool ScrollPool { get; } + private DataHeightCache sisterCache { get; } - public DataHeightManager(ScrollPool scrollPool) + public DataHeightCache(ScrollPool scrollPool) { ScrollPool = scrollPool; } + public DataHeightCache(ScrollPool scrollPool, DataHeightCache sisterCache) : this(scrollPool) + { + this.sisterCache = sisterCache; + + ExplorerCore.Log("Creating backup height cache, this count: " + scrollPool.DataSource.ItemCount); + AddRange(sisterCache.Take(scrollPool.DataSource.ItemCount)); + } + private readonly List heightCache = new List(); public int Count => heightCache.Count; @@ -62,6 +71,17 @@ namespace UnityExplorer.UI.Widgets totalHeight += value; } + public void AddRange(IEnumerable collection) + { + foreach (var entry in collection) + Add(entry); + } + + public IEnumerable Take(int count) + { + return heightCache.Take(count); + } + public void RemoveLast() { if (!heightCache.Any()) @@ -70,13 +90,6 @@ namespace UnityExplorer.UI.Widgets var val = heightCache[heightCache.Count - 1]; totalHeight -= val; heightCache.RemoveAt(heightCache.Count - 1); - - } - - public void Clear() - { - heightCache.Clear(); - totalHeight = 0f; } private void AppendDataSpread(int dataIdx, int spread) @@ -88,10 +101,17 @@ namespace UnityExplorer.UI.Widgets } } - public void SetIndex(int dataIndex, float value) + public void SetIndex(int dataIndex, float value, bool ignoreDataCount = false) { - if (dataIndex >= ScrollPool.DataSource.ItemCount) - return; + if (!ignoreDataCount) + { + if (dataIndex >= ScrollPool.DataSource.ItemCount) + { + while (heightCache.Count > dataIndex) + RemoveLast(); + return; + } + } if (dataIndex >= heightCache.Count) { @@ -183,10 +203,20 @@ namespace UnityExplorer.UI.Widgets rangeToDataIndexCache.RemoveAt(rangeStart); } } + + // if sister cache is set, then update it too. + if (sisterCache != null) + { + var realIdx = ScrollPool.DataSource.GetRealIndexOfTempIndex(dataIndex); + if (realIdx >= 0) + sisterCache.SetIndex(realIdx, value, true); + } } public int GetDataIndexAtPosition(float desiredHeight) - => GetDataIndexAtPosition(desiredHeight, out _); + { + return GetDataIndexAtPosition(desiredHeight, out _); + } public int GetDataIndexAtPosition(float desiredHeight, out DataViewInfo cache) { diff --git a/src/UI/Widgets/ScrollPool/IPoolDataSource.cs b/src/UI/Widgets/ScrollPool/IPoolDataSource.cs index 2d9074b..505978f 100644 --- a/src/UI/Widgets/ScrollPool/IPoolDataSource.cs +++ b/src/UI/Widgets/ScrollPool/IPoolDataSource.cs @@ -13,6 +13,8 @@ namespace UnityExplorer.UI.Widgets void SetCell(ICell cell, int index); void DisableCell(ICell cell, int index); + int GetRealIndexOfTempIndex(int tempIndex); + ICell CreateCell(RectTransform cellTransform); } } diff --git a/src/UI/Widgets/ScrollPool/ScrollPool.cs b/src/UI/Widgets/ScrollPool/ScrollPool.cs index 249f46b..3e08a03 100644 --- a/src/UI/Widgets/ScrollPool/ScrollPool.cs +++ b/src/UI/Widgets/ScrollPool/ScrollPool.cs @@ -49,11 +49,12 @@ namespace UnityExplorer.UI.Widgets /// The first and last pooled indices relative to the DataSource's list /// private int bottomDataIndex; - private int TopDataIndex => bottomDataIndex - CellPool.Count + 1; + private int TopDataIndex => Math.Max(0, bottomDataIndex - CellPool.Count + 1); private readonly List CellPool = new List(); - private DataHeightManager HeightCache; + internal DataHeightCache HeightCache; + internal DataHeightCache tempHeightCache; private float TotalDataHeight => HeightCache.TotalHeight + contentLayout.padding.top + contentLayout.padding.bottom; @@ -64,8 +65,8 @@ namespace UnityExplorer.UI.Widgets private int CurrentDataCount => bottomDataIndex + 1; - private Vector2 _prevAnchoredPos; - private float _prevViewportHeight; // TODO track viewport height and add if height increased + private Vector2 prevAnchoredPos; + private float prevViewportHeight; #region Internal set tracking and update @@ -84,20 +85,54 @@ namespace UnityExplorer.UI.Widgets private bool writingLocked; private float timeofLastWriteLock; + private float prevContentHeight; + public override void Update() { if (writingLocked && timeofLastWriteLock < Time.time) writingLocked = false; + + if (prevContentHeight == 0.0f && Content?.rect.height != 0.0f) + prevContentHeight = Content.rect.height; + else if (Content.rect.height != prevContentHeight) + { + prevContentHeight = Content.rect.height; + OnValueChangedListener(Vector2.zero); + } } #endregion - - // Initialize + + // Public methods public void Rebuild() { - Initialize(DataSource, PrototypeCell); + RecreateCellPool(true, true, null); } + public void EnableTempCache() + { + if (tempHeightCache == null) + tempHeightCache = HeightCache; + + HeightCache = new DataHeightCache(this, tempHeightCache); + } + + public void DisableTempCache() + { + if (tempHeightCache == null) + return; + + HeightCache = tempHeightCache; + tempHeightCache = null; + } + + public void RefreshCells(bool reloadData) + { + RefreshCells(reloadData, true); + } + + // Initialize + public void Initialize(IPoolDataSource dataSource, RectTransform prototypeCell) { if (!prototypeCell) @@ -106,7 +141,7 @@ namespace UnityExplorer.UI.Widgets this.PrototypeCell = prototypeCell; PrototypeCell.transform.SetParent(Viewport, false); - HeightCache = new DataHeightManager(this); + HeightCache = new DataHeightCache(this); DataSource = dataSource; this.contentLayout = ScrollRect.content.GetComponent(); @@ -126,7 +161,7 @@ namespace UnityExplorer.UI.Widgets yield return null; // set intial bounds - _prevAnchoredPos = Content.anchoredPosition; + prevAnchoredPos = Content.anchoredPosition; SetRecycleViewBounds(false); // create initial cell pool and set cells @@ -197,24 +232,32 @@ namespace UnityExplorer.UI.Widgets RecycleViewBounds = new Vector2(Viewport.MinY() + HalfThreshold, Viewport.MaxY() - HalfThreshold); - if (checkHeightGrow && _prevViewportHeight < Viewport.rect.height && _prevViewportHeight != 0.0f) - { - ret = ExtendCellPool(); - } + if (checkHeightGrow && prevViewportHeight < Viewport.rect.height && prevViewportHeight != 0.0f) + ret = RecreateCellPool(false, false, null); - _prevViewportHeight = Viewport.rect.height; + prevViewportHeight = Viewport.rect.height; return ret; } - private bool ExtendCellPool() + private bool RecreateCellPool(bool forceRecreate, bool resetDataIndex, bool? setTempCacheEnabledTo) { + if (setTempCacheEnabledTo != null) + { + if (setTempCacheEnabledTo == true) + EnableTempCache(); + else if (setTempCacheEnabledTo == false) + DisableTempCache(); + } + bool ret = false; + CheckDataSourceCountChange(out _); + var requiredCoverage = Math.Abs(RecycleViewBounds.y - RecycleViewBounds.x); var currentCoverage = CellPool.Count * PrototypeHeight; int cellsRequired = (int)Math.Ceiling((decimal)(requiredCoverage - currentCoverage) / (decimal)PrototypeHeight); - if (cellsRequired > 0) + if (cellsRequired > 0 || forceRecreate) { ret = true; WritingLocked = true; @@ -233,7 +276,7 @@ namespace UnityExplorer.UI.Widgets bottomDataIndex = maxDataIndex; // CreateCellPool will destroy existing cells and recreate list. - CreateCellPool(false); + CreateCellPool(resetDataIndex); LayoutRebuilder.ForceRebuildLayoutImmediate(Content); @@ -241,6 +284,7 @@ namespace UnityExplorer.UI.Widgets ScrollRect.UpdatePrevData(); SetScrollBounds(); + UpdateSliderHandle(true); } return ret; @@ -272,32 +316,40 @@ namespace UnityExplorer.UI.Widgets } } - public void RefreshCells(bool andReloadFromDataSource = false, bool setSlider = true) + private bool CheckDataSourceCountChange(out bool shouldJumpToBottom) + { + bool ret = false; + shouldJumpToBottom = false; + + int count = DataSource.ItemCount; + if (bottomDataIndex > count && bottomDataIndex >= CellPool.Count) + { + bottomDataIndex = Math.Max(count - 1, CellPool.Count - 1); + shouldJumpToBottom = true; + } + + if (HeightCache.Count < count) + { + HeightCache.SetIndex(count - 1, PrototypeHeight); + return true; + } + else if (HeightCache.Count > count) + { + while (HeightCache.Count > count) + HeightCache.RemoveLast(); + return false; + } + + return ret; + } + + private void RefreshCells(bool andReloadFromDataSource, bool setSlider) { if (!CellPool.Any()) return; SetRecycleViewBounds(true); - // jump to bottom if the data count went below our bottom data index - bool jumpToBottom = false; - - if (andReloadFromDataSource) - { - int count = DataSource.ItemCount; - if (bottomDataIndex > count) - { - bottomDataIndex = Math.Max(count - 1, CellPool.Count - 1); - jumpToBottom = true; - } - - if (HeightCache.Count < count) - HeightCache.SetIndex(count - 1, PrototypeHeight); - else if (HeightCache.Count > count) - { - while (HeightCache.Count > count) - HeightCache.RemoveLast(); - } - } + CheckDataSourceCountChange(out bool jumpToBottom); // update date height cache, and set cells if 'andReload' var enumerator = GetPoolEnumerator(); @@ -339,9 +391,7 @@ namespace UnityExplorer.UI.Widgets DataSource.SetCell(cachedCell, dataIndex); LayoutRebuilder.ForceRebuildLayoutImmediate(cachedCell.Rect); - - if (dataIndex < DataSource.ItemCount) - HeightCache.SetIndex(dataIndex, cachedCell.Rect.rect.height); + HeightCache.SetIndex(dataIndex, cachedCell.Rect.rect.height); } // Value change processor @@ -355,9 +405,9 @@ namespace UnityExplorer.UI.Widgets ScrollRect.StopMovement(); if (!SetRecycleViewBounds(true)) - RefreshCells(); + RefreshCells(false); - float yChange = (ScrollRect.content.anchoredPosition - _prevAnchoredPos).y; + float yChange = (ScrollRect.content.anchoredPosition - prevAnchoredPos).y; float adjust = 0f; if (yChange > 0) // Scrolling down @@ -377,7 +427,7 @@ namespace UnityExplorer.UI.Widgets ScrollRect.m_PrevPosition += vector; LayoutRebuilder.ForceRebuildLayoutImmediate(Content); - _prevAnchoredPos = ScrollRect.content.anchoredPosition; + prevAnchoredPos = ScrollRect.content.anchoredPosition; SetScrollBounds(); @@ -468,6 +518,8 @@ namespace UnityExplorer.UI.Widgets private void UpdateSliderHandle(bool forcePositionValue = true) { + CheckDataSourceCountChange(out _); + var dataHeight = TotalDataHeight; // calculate handle size based on viewport / total data height @@ -491,7 +543,10 @@ namespace UnityExplorer.UI.Widgets float val = 0f; if (TotalDataHeight > 0f) { - var topPos = HeightCache[TopDataIndex].startPosition; + float topPos = 0f; + if (HeightCache.Count > 0) + topPos = HeightCache[TopDataIndex].startPosition; + var scrollPos = topPos + Content.anchoredPosition.y; val = (float)((decimal)scrollPos / (decimal)(TotalDataHeight - Viewport.rect.height)); @@ -518,35 +573,30 @@ namespace UnityExplorer.UI.Widgets var desiredPosition = val * scrollHeight + NormalizedScrollBounds.x; // add offset above it for viewport height - var halfheight = Viewport.rect.height * 0.5f; - var desiredMinY = desiredPosition - halfheight; + var halfView = Viewport.rect.height * 0.5f; + var desiredMinY = desiredPosition - halfView; // get the data index at the top of the viewport int topViewportIndex = HeightCache.GetDataIndexAtPosition(desiredMinY); topViewportIndex = Math.Max(0, topViewportIndex); + topViewportIndex = Math.Min(DataSource.ItemCount - 1, topViewportIndex); // get the real top pooled data index to display our content int poolStartIndex = Math.Max(0, topViewportIndex - (int)(ExtraPoolCells * 0.5f)); - poolStartIndex = Math.Min(DataSource.ItemCount - CellPool.Count, poolStartIndex); - - // for content at the very top, just use the desired position as the anchor pos. - if (desiredMinY < RecycleThreshold * 0.5f) - { - Content.anchoredPosition = new Vector2(0, desiredMinY); - } - else // else calculate anchor pos - { - var topStartPos = HeightCache[poolStartIndex].startPosition; - - // how far the actual top cell is from our desired center - var diff = desiredMinY - topStartPos; - - Content.anchoredPosition = new Vector2(0, diff); - } + poolStartIndex = Math.Min(Math.Max(0, DataSource.ItemCount - CellPool.Count), poolStartIndex); bottomDataIndex = poolStartIndex + CellPool.Count - 1; RefreshCells(true, false); + var topStartPos = HeightCache[poolStartIndex].startPosition; + + float desiredAnchor; + if (desiredMinY < HalfThreshold) + desiredAnchor = desiredMinY; + else + desiredAnchor = desiredMinY - topStartPos; + Content.anchoredPosition = new Vector2(0, desiredAnchor); + UpdateSliderHandle(true); } diff --git a/src/UI/Widgets/TransformTree/TransformTree.cs b/src/UI/Widgets/TransformTree/TransformTree.cs index a39fae4..4aea5ed 100644 --- a/src/UI/Widgets/TransformTree/TransformTree.cs +++ b/src/UI/Widgets/TransformTree/TransformTree.cs @@ -11,6 +11,8 @@ namespace UnityExplorer.UI.Widgets { public class TransformTree : IPoolDataSource { + public int GetRealIndexOfTempIndex(int index) => throw new NotImplementedException("TODO"); + public Func> GetRootEntriesMethod; public bool Filtering => !string.IsNullOrEmpty(currentFilter); @@ -93,7 +95,7 @@ namespace UnityExplorer.UI.Widgets : expandedInstanceIDs.Contains(instanceID); } - public void RefreshData(bool andReload = false) + public void RefreshData(bool andReload = false, bool hardReload = false) { displayedObjects.Clear(); @@ -106,7 +108,12 @@ namespace UnityExplorer.UI.Widgets } if (andReload) - Scroller.RefreshCells(true); + { + if (!hardReload) + Scroller.RefreshCells(true); + else + Scroller.Rebuild(); + } } private void Traverse(Transform transform, CachedTransform parent = null) diff --git a/src/UnityExplorer.csproj b/src/UnityExplorer.csproj index 632e6d4..99edc33 100644 --- a/src/UnityExplorer.csproj +++ b/src/UnityExplorer.csproj @@ -272,7 +272,7 @@ - +