PappaP

ItemDatabase.cs

Mar 16th, 2020
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.52 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5.  
  6. [CreateAssetMenu(menuName = "Inventory/ItemDatabase")]
  7. public class ItemDatabase : ScriptableObject
  8. {
  9.  
  10.     public List<InventoryItem> items = new List<InventoryItem>();
  11.  
  12.     public InventoryItem GetItem(string itemName)
  13.     {
  14.         for (int i = 0; i < items.Count; i++)
  15.         {
  16.             if(items[i].itemName == itemName)
  17.             {
  18.                 return items[i];
  19.             }
  20.         }
  21.  
  22.         return null;
  23.     }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment