Bug when using a prefab with 'Expand to parent' in conjunction with ListView/ItemView #329
Replies: 2 comments 1 reply
-
My thinking is that the issue comes from the fact that the ListView's visual representation of a given data collection is virtualized, feels like it's a situation where we should be able to force a listview to load and display ALL items? |
Beta Was this translation helpful? Give feedback.
-
@mchamplain is right on the nose :) Due to the virtualized nature of the List View and its optimizations to handle virtualized scrolling, using That said, you have a few options to handle the scenario you're describing:
[SerializeField]
private ItemView tabPrefab = null;
[SerializeField]
private UIBlock tabBar = null;
[SerializeField]
private List<SettingsCollectionSo> settingsCollectionSo = null;
private Dictionary<ItemView, int> tabs = new Dictionary<ItemView, int>();
...
private void Start()
{
for (int i = 0; i < settingsCollectionSo.Count; ++i)
{
ItemView tab = Instantiate(tabPrefab);
tab.transform.parent = tabBar.transform;
// You'll need to slightly modify your BindTab method signature for this to compile
BindTab(settingsCollectionSo[i], tab.Visuals as TabButtonVisuals);
// Save tab->index mapping for lookups later
tabs[tab] = i;
}
}
...
// slight changes here
private void HandleTabClicked(Gesture.OnClick evt, TabButtonVisuals target)
{
int index = tabs[target.View];
// the rest unchanged
...
} Other than that you should only have to remove If you go with option (2), you can use your existing |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
So we are currently following the sample menu you created (Toon/Sci-fi), and it's working quite well. However, we encountered an issue where only two tabs were displayed in the menu. After a lot of debugging, we found that the prefab (e.g., SettingsTab_Toon) cannot have a size set to 'Expand to parent.'
Enabling 'Expand to parent' causes Nova to only display two tabs, even if you have more in your collection of scriptable objects. We are using this option because we want our tabs to be dynamic. Due to localization requirements, we prefer not to have fixed tab sizes.
This is the result when using a prefab with a fixed size:

And the result with a prefab having the 'Expand to parent' option enabled:

We are uncertain whether this issue is a true bug or an intended behavior.
Do you have any suggestions on how to resolve this?
If you need more information or detail, don't hesitate!
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions