KrejwenBAN
Member
HI,
UIS version 1.1.81
I have a strange bug with player inventory. I created a new inventory grid and add tabs.
When I start the game I get the following error:
and also (probably this is the react for previous error)
The problem started when I added a tabs to the grid.
I found that problem is in method:
In line
I get the null as result
How can I solve the problem?
UIS version 1.1.81
I have a strange bug with player inventory. I created a new inventory grid and add tabs.
When I start the game I get the following error:
C#:
NullReferenceException: Object reference not set to an instance of an object
Opsive.UltimateInventorySystem.UI.Grid.GridEventSystem.GetSelectedButtonIndex () (at Assets/3rd-Party/Opsive/UltimateInventorySystem/Scripts/UI/Grid/GridEventSystem.cs:345)
Opsive.UltimateInventorySystem.UI.Grid.GridEventSystem.GetSelectedButton () (at Assets/3rd-Party/Opsive/UltimateInventorySystem/Scripts/UI/Grid/GridEventSystem.cs:357)
Opsive.UltimateInventorySystem.UI.Grid.GridGeneric`1[T].DrawInternal () (at Assets/3rd-Party/Opsive/UltimateInventorySystem/Scripts/UI/Grid/GridGeneric.cs:306)
Opsive.UltimateInventorySystem.UI.Grid.GridBase.Draw () (at Assets/3rd-Party/Opsive/UltimateInventorySystem/Scripts/UI/Grid/GridBase.cs:311)
Opsive.UltimateInventorySystem.UI.Item.InventoryGrid.DrawInternal () (at Assets/3rd-Party/Opsive/UltimateInventorySystem/Scripts/UI/Item/InventoryGrid.cs:182)
Opsive.UltimateInventorySystem.UI.Item.ItemViewSlotsContainerBase.Draw () (at Assets/3rd-Party/Opsive/UltimateInventorySystem/Scripts/UI/Item/ItemViewSlotsContainerBase.cs:624)
Opsive.UltimateInventorySystem.UI.Panels.ItemViewSlotContainers.InventoryGridTabControlBinding.HandleTabChange (System.Int32 previousIndex, System.Int32 newIndex) (at Assets/3rd-Party/Opsive/UltimateInventorySystem/Scripts/UI/Panels/ItemViewSlotContainers/InventoryGridTabControlBinding.cs:114)
Opsive.UltimateInventorySystem.UI.TabControl.SetTabOn (System.Int32 index) (at Assets/3rd-Party/Opsive/UltimateInventorySystem/Scripts/UI/TabControl.cs:179)
Opsive.UltimateInventorySystem.UI.Panels.ItemViewSlotContainers.InventoryGridTabControlBinding.OnBindItemViewSlotContainer () (at Assets/3rd-Party/Opsive/UltimateInventorySystem/Scripts/UI/Panels/ItemViewSlotContainers/InventoryGridTabControlBinding.cs:36)
Opsive.UltimateInventorySystem.UI.Panels.ItemViewSlotContainers.ItemViewSlotsContainerInventoryGridBinding.BindItemViewSlotContainer (Opsive.UltimateInventorySystem.UI.Item.ItemViewSlotsContainerBase container) (at Assets/3rd-Party/Opsive/UltimateInventorySystem/Scripts/UI/Panels/ItemViewSlotContainers/ItemViewSlotsContainerBinding.cs:127)
Opsive.UltimateInventorySystem.UI.Item.ItemViewSlotsContainerBase.Initialize (System.Boolean force) (at Assets/3rd-Party/Opsive/UltimateInventorySystem/Scripts/UI/Item/ItemViewSlotsContainerBase.cs:271)
Opsive.UltimateInventorySystem.UI.Item.InventoryGrid.Initialize (System.Boolean force) (at Assets/3rd-Party/Opsive/UltimateInventorySystem/Scripts/UI/Item/InventoryGrid.cs:84)
Opsive.UltimateInventorySystem.UI.Panels.ItemViewSlotContainers.ItemViewSlotsContainerPanelBinding.OnInitializeBeforeInventoryBind () (at Assets/3rd-Party/Opsive/UltimateInventorySystem/Scripts/UI/Panels/ItemViewSlotContainers/ItemViewSlotsContainerPanelBinding.cs:62)
Opsive.UltimateInventorySystem.UI.Panels.ItemViewSlotContainers.InventoryPanelBinding.Initialize (Opsive.UltimateInventorySystem.UI.Panels.DisplayPanel display, System.Boolean force) (at Assets/3rd-Party/Opsive/UltimateInventorySystem/Scripts/UI/Panels/ItemViewSlotContainers/InventoryPanelBinding.cs:42)
Opsive.UltimateInventorySystem.UI.Panels.ItemViewSlotContainers.ItemViewSlotsContainerPanelBinding.Initialize (Opsive.UltimateInventorySystem.UI.Panels.DisplayPanel display, System.Boolean force) (at Assets/3rd-Party/Opsive/UltimateInventorySystem/Scripts/UI/Panels/ItemViewSlotContainers/ItemViewSlotsContainerPanelBinding.cs:42)
Opsive.UltimateInventorySystem.UI.Panels.DisplayPanel.Setup (Opsive.UltimateInventorySystem.UI.Panels.DisplayPanelManager manager, System.Boolean force) (at Assets/3rd-Party/Opsive/UltimateInventorySystem/Scripts/UI/Panels/DisplayPanel.cs:130)
Opsive.UltimateInventorySystem.UI.Panels.DisplayPanelManager.SetupDisplayPanels (System.Boolean force) (at Assets/3rd-Party/Opsive/UltimateInventorySystem/Scripts/UI/Panels/DisplayPanelManager.cs:129)
Opsive.UltimateInventorySystem.UI.Panels.DisplayPanelManager.SetPanelOwner (UnityEngine.GameObject panelOwner) (at Assets/3rd-Party/Opsive/UltimateInventorySystem/Scripts/UI/Panels/DisplayPanelManager.cs:155)
Opsive.UltimateInventorySystem.UI.Panels.DisplayPanelManager.Initialize (System.Boolean force) (at Assets/3rd-Party/Opsive/UltimateInventorySystem/Scripts/UI/Panels/DisplayPanelManager.cs:118)
Opsive.UltimateInventorySystem.UI.Panels.DisplayPanelManager.Awake () (at Assets/3rd-Party/Opsive/UltimateInventorySystem/Scripts/UI/Panels/DisplayPanelManager.cs:78)
and also (probably this is the react for previous error)
C#:
The Display Panel with the name 'Overflow Menu' for the menu of type 'OverflowInventoryMenu' was not found
UnityEngine.Debug:LogError (object,UnityEngine.Object)
Opsive.UltimateInventorySystem.UI.Panels.InventoryPanelOpener`1<YYG2.UI.OverflowInventoryMenu>:Initialize (bool) (at Assets/3rd-Party/Opsive/UltimateInventorySystem/Scripts/UI/Panels/InventoryPanelOpener.cs:82)
Opsive.UltimateInventorySystem.UI.Panels.PanelOpener:Start () (at Assets/3rd-Party/Opsive/UltimateInventorySystem/Scripts/UI/Panels/PanelOpener.cs:31)
YYG2.UI.OverflowMenuOpener:Start () (at Assets/Project/Scripts/Core/UI/Inventory/OverflowMenuOpener.cs:22)
The problem started when I added a tabs to the grid.
I found that problem is in method:
C#:
protected virtual EventSystem GetEventSystemForInternal(GameObject localGameObject)
{
if (localGameObject == null) {
return EventSystem.current;
}
if (m_GameObjectToEventSystemMap.TryGetValue(localGameObject, out var eventSystem)) {
if (eventSystem != null) {
return eventSystem;
}
}
var root = localGameObject.transform.root;
var identifier = root.gameObject.GetCachedComponent<EventSystemIdentifier>();
eventSystem = identifier == null ? EventSystem.current : identifier.EventSystem;
m_GameObjectToEventSystemMap[localGameObject] = eventSystem;
return eventSystem;
}
In line
C#:
eventSystem = identifier == null ? EventSystem.current : identifier.EventSystem;
How can I solve the problem?