Skip to content

Commit

Permalink
Multiple ListViews can now share a single container transform
Browse files Browse the repository at this point in the history
  • Loading branch information
adrenak committed Aug 7, 2024
1 parent 5ea082b commit e0973e0
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions Assets/Adrenak.UGX/Runtime/Views/ListView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,11 @@ public void Add(T state) {
var view = Get();
view.gameObject.name =
$"{(string.IsNullOrEmpty(state.ID) ? "" : state.ID)} ({typeof(T).Name})";
int active = 0;
for (int i = 0; i < container.childCount; i++)
if (container.GetChild(i).gameObject.activeSelf)
active++;
view.transform.SetSiblingIndex(active);
view.State = state;

Views.Add(view);
Expand Down Expand Up @@ -212,9 +217,9 @@ public void Reset() {
break;
t = t.parent;
}
if (insideTemplate)
continue;

if (insideTemplate)
continue;

if (child == null
|| child.gameObject == null
|| child.parent == null
Expand Down

0 comments on commit e0973e0

Please sign in to comment.