shopping-cart-sim/Assets/Scripts/KeyPickup.cs

16 lines
331 B
C#

using UnityEngine;
public class KeyPickup : MonoBehaviour
{
public static bool hasKeys = false;
private void OnTriggerEnter(Collider other)
{
if (other.CompareTag("Player"))
{
hasKeys = true;
Debug.Log("Picked up the keys!");
Destroy(gameObject);
}
}
}