mirror of
https://github.com/sinai-dev/UnityExplorer.git
synced 2025-06-16 22:27:45 +08:00
Clear GameObject Component and Transform lists properly on close
This commit is contained in:
parent
0b973393d1
commit
365269b0dd
@ -63,7 +63,7 @@ namespace UnityExplorer.UI.Inspectors
|
|||||||
addCompInput.Text = "";
|
addCompInput.Text = "";
|
||||||
|
|
||||||
TransformTree.Clear();
|
TransformTree.Clear();
|
||||||
ComponentList.Clear();
|
UpdateComponents();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void CloseInspector()
|
public override void CloseInspector()
|
||||||
@ -112,6 +112,9 @@ namespace UnityExplorer.UI.Inspectors
|
|||||||
|
|
||||||
private IEnumerable<GameObject> GetTransformEntries()
|
private IEnumerable<GameObject> GetTransformEntries()
|
||||||
{
|
{
|
||||||
|
if (!GOTarget)
|
||||||
|
return Enumerable.Empty<GameObject>();
|
||||||
|
|
||||||
cachedChildren.Clear();
|
cachedChildren.Clear();
|
||||||
for (int i = 0; i < GOTarget.transform.childCount; i++)
|
for (int i = 0; i < GOTarget.transform.childCount; i++)
|
||||||
cachedChildren.Add(GOTarget.transform.GetChild(i).gameObject);
|
cachedChildren.Add(GOTarget.transform.GetChild(i).gameObject);
|
||||||
@ -124,10 +127,21 @@ namespace UnityExplorer.UI.Inspectors
|
|||||||
private readonly List<bool> behaviourEnabledStates = new List<bool>();
|
private readonly List<bool> behaviourEnabledStates = new List<bool>();
|
||||||
|
|
||||||
// ComponentList.GetRootEntriesMethod
|
// ComponentList.GetRootEntriesMethod
|
||||||
private List<Component> GetComponentEntries() => componentEntries;
|
private List<Component> GetComponentEntries() => GOTarget ? componentEntries : Enumerable.Empty<Component>().ToList();
|
||||||
|
|
||||||
public void UpdateComponents()
|
public void UpdateComponents()
|
||||||
{
|
{
|
||||||
|
if (!GOTarget)
|
||||||
|
{
|
||||||
|
componentEntries.Clear();
|
||||||
|
compInstanceIDs.Clear();
|
||||||
|
behaviourEntries.Clear();
|
||||||
|
behaviourEnabledStates.Clear();
|
||||||
|
ComponentList.RefreshData();
|
||||||
|
ComponentList.ScrollPool.Refresh(true, true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Check if we actually need to refresh the component cells or not.
|
// Check if we actually need to refresh the component cells or not.
|
||||||
var comps = GOTarget.GetComponents<Component>();
|
var comps = GOTarget.GetComponents<Component>();
|
||||||
var behaviours = GOTarget.GetComponents<Behaviour>();
|
var behaviours = GOTarget.GetComponents<Behaviour>();
|
||||||
|
@ -21,7 +21,8 @@ namespace UnityExplorer.UI.Inspectors
|
|||||||
|
|
||||||
public void Clear()
|
public void Clear()
|
||||||
{
|
{
|
||||||
this.currentEntries.Clear();
|
RefreshData();
|
||||||
|
ScrollPool.Refresh(true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool CheckShouldDisplay(Component _, string __) => true;
|
private bool CheckShouldDisplay(Component _, string __) => true;
|
||||||
|
@ -83,6 +83,7 @@ namespace UnityExplorer.UI.Widgets
|
|||||||
displayIndex = 0;
|
displayIndex = 0;
|
||||||
autoExpandedIDs.Clear();
|
autoExpandedIDs.Clear();
|
||||||
expandedInstanceIDs.Clear();
|
expandedInstanceIDs.Clear();
|
||||||
|
this.ScrollPool.Refresh(true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsCellExpanded(int instanceID)
|
public bool IsCellExpanded(int instanceID)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user