Skip to content

Commit

Permalink
Resolved issue where item appeared on ground when moved to container …
Browse files Browse the repository at this point in the history
…via UI. (#570)

Added six slots to the Disposal Bin.
  • Loading branch information
Ryan089 authored Sep 27, 2020
1 parent fa6640e commit ec44086
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ MonoBehaviour:
containerFilter: {fileID: 0}
volumeLimited: 1
maxVolume: 50
slots: 0
slots: 6
--- !u!114 &4265221962216021434
MonoBehaviour:
m_ObjectHideFlags: 0
Expand Down
3 changes: 1 addition & 2 deletions Assets/Engine/Inventory/Container.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ public virtual void AddItem(int slot, GameObject item)
if (!CanStore(this, itemComponent))
throw new Exception("Item cannot be stored");

item.SetActive(false);
items[slot] = item;
itemComponent.container = this;
RecalculateVolume(this);
Expand All @@ -106,7 +107,6 @@ public virtual void AddItem(int slot, GameObject item)
[Server]
public int AddItem(GameObject item)
{
item.SetActive(false);
var itemComponent = item.GetComponent<Item>();
for (int i = 0; i < items.Count; ++i) {
if (items[i] == null && CanStore(this, itemComponent)) {
Expand All @@ -115,7 +115,6 @@ public int AddItem(GameObject item)
}
}
RecalculateVolume(this);

return -1;
}

Expand Down

0 comments on commit ec44086

Please sign in to comment.