Try to put `Tab Control` component to Tab Control node like what Storage Menu did, but encounter an exception at the start of game.

Justus

Member
I noticed that the Storage Menu prefab in RPG schema put `Tab Control` on Tab Control directly, which is different from what you generate from UI Designer.
So I mimic this relation and doing following things.
1. remove `Tab Control` component in inventory grid
2. add `Tab Control` to the parent node of `Tab Toggle` nodes, set the `Content` parameter to itself1652179681042.png
3. fix the dependency in `Inventory Grid Tab Control Binding`
1652179758438.png


I thought it's same as Storage Menu now, but after enter Play Mode, following exception thrown:
1652179865115.png

Where I did wrong?
 
it is possible this is a bug.

Could you add a condition where you are getting the error?
Code:
if (previousIndex >= 0 && previousIndex < m_TabControl.TabToggles.Count) {
    // Save the indexed items data.
    var previousInventoryGridTabData = m_TabControl.TabToggles[previousIndex]?.GetComponent<InventoryTabData>();
    if (previousInventoryGridTabData != null) {
        previousInventoryGridTabData.Initialize(false);
        previousInventoryGridTabData.Unselected(m_InventoryGrid);
    }
}
Let me know if that fixes it
 
it is possible this is a bug.

Could you add a condition where you are getting the error?
Code:
if (previousIndex >= 0 && previousIndex < m_TabControl.TabToggles.Count) {
    // Save the indexed items data.
    var previousInventoryGridTabData = m_TabControl.TabToggles[previousIndex]?.GetComponent<InventoryTabData>();
    if (previousInventoryGridTabData != null) {
        previousInventoryGridTabData.Initialize(false);
        previousInventoryGridTabData.Unselected(m_InventoryGrid);
    }
}
Let me know if that fixes it
After replaced this code. The Exception disappear, but the Tab still could not be switched by `Next Tab Input` and `Previous Tab Input` which indicated in `Item Info Grid` component.
 
Top