diff --git a/.gitignore b/.gitignore index 3266895..adfac34 100644 --- a/.gitignore +++ b/.gitignore @@ -56,3 +56,6 @@ crashlytics-build.properties .idea/.idea.RedDead2D/.idea/contentModel.xml .idea/.idea.RedDead2D/.idea/workspace.xml Packages/manifest.json +.idea/.idea.RedDead2D/.idea/contentModel.xml +.idea/.idea.RedDead2D/.idea/contentModel.xml +Packages/packages-lock.json diff --git a/Assets/Scripts/Inventory/Controller.cs b/Assets/Scripts/Inventory/Controller.cs index 1d6a996..154081b 100644 --- a/Assets/Scripts/Inventory/Controller.cs +++ b/Assets/Scripts/Inventory/Controller.cs @@ -254,13 +254,25 @@ public void RefreshUI() uiObjects[i].Item = Inventory[i].Item; uiObjects[i].UpdateUI(); } + else + { + uiObjects[i].spriteRenderer.enabled = false; + } } for (int i = 0; i < 9; i++) { - if(Inventory[i] == null) continue; - hotbarObjects[i].GetComponent().Item = Inventory[i].Item; - hotbarObjects[i].GetComponent().UpdateUI(); + // if a item is removed from the inventory make sure to actually remove it from the ui by disabling the rendere + if (Inventory[i] == null) + { + hotbarObjects[i].GetComponent().spriteRenderer.enabled = false; + } + else + { + hotbarObjects[i].GetComponent().Item = Inventory[i].Item; + hotbarObjects[i].GetComponent().UpdateUI(); + } + } }