Je travaille sur un system d'inventaire mais je rencontre un probleme.
J'utilise un "scriptable Object" pour les différents items:
Code : Tout sélectionner
[CreateAssetMenu]
public class ItemData : ScriptableObject
{
public string displayName;
public Sprite icon;
public string description;
}
Code : Tout sélectionner
public class Inventory : MonoBehaviour
{
public List<InventoryItem> inventory = new List<InventoryItem>();
private Dictionary<ItemData, InventoryItem> itemDictionary= new Dictionary<ItemData, InventoryItem>();
Code : Tout sélectionner
public Inventory invtPlayer;//gameObject Inventaire
//1er tentative:
public List<InventoryItem> inventLst = invtPlayer.inventory;
//2eme tentative:
public List<InventoryItem> inventLst = invtPlayer.GetComponent <List<InventoryItem>>;