[CreateAssetMenu(fileName = “Item”)]
public class Item : ScriptableObject
{
[Header(“ItemStats”)]
//name
public string itemName;
//icon
public Sprite Icon;
//item description
public string itemDescription;
//Id
public int itemID;
//Weight
public float weight;
public float Weight
{
get { return weight; }
set { weight = value; }
}
}
public class Inventory : MonoBehaviour
{
[SerializeField] List items;
[SerializeField] Transform itemsParent;
[SerializeField] ItemSlot itemSlots;
public Item item;
public float currentweight = 0;
public float totalweight = 100;
private void RefreshUI()
{
int i = 0;
for(; i < items.Count && i < itemSlots.Length; i++)
{
itemSlots_.item = items*;*_
currentweight += item.weight;
}
for(; i < itemSlots.Length; i++)
{
itemSlots*.item = null;*
}
}
}
I’m trying to add a weight system to my inventory like fallout but it just take information from my one scriptable object rather than the item in the slot. How can I make the script read the item in slots indivisual rather than setting a value for all items.