Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- public class Item : MonoBehaviour
- {
- [SerializeField] private string _itemName;
- public string ItemName => _itemName;
- private void OnTriggerEnter(Collider other)
- {
- if(other.TryGetComponent(out PlayerInventory inventory))
- {
- inventory.AddItem(this);
- Destroy(gameObject);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement