Skip to content

Commit

Permalink
Fixed ui reloading
Browse files Browse the repository at this point in the history
  • Loading branch information
TSKsmiley committed Apr 19, 2021
1 parent 3b09ad5 commit c3cb012
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
18 changes: 15 additions & 3 deletions Assets/Scripts/Inventory/Controller.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<ItemObject>().Item = Inventory[i].Item;
hotbarObjects[i].GetComponent<ItemObject>().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<ItemObject>().spriteRenderer.enabled = false;
}
else
{
hotbarObjects[i].GetComponent<ItemObject>().Item = Inventory[i].Item;
hotbarObjects[i].GetComponent<ItemObject>().UpdateUI();
}

}

}
Expand Down

0 comments on commit c3cb012

Please sign in to comment.