- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class Memory : MonoBehaviour
- {
- [SerializeField] private Item myMemory;
- [SerializeField] private Inventory inv;
- private void Start()
- {
- foreach(Item i in inv.inventory)
- {
- if (i.name == myMemory.name) Destroy(gameObject);
- }
- }
- private void OnCollisionEnter(Collision collision)
- {
- inv.inventory.Add(myMemory);
- Destroy(gameObject);
- }
- }