You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
RatAttack2D/Assets/ItemColliector.cs

24 lines
572 B

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using TMPro;
public class ItemColliector : MonoBehaviour
{
private int Blue_Cheese = 0;
public TMP_Text BlueCheeseText;
private void OnTriggerEnter2D(Collider2D collision)
{
if (collision.gameObject.CompareTag("Blue Cheese"))
{
Destroy(collision.gameObject);
Blue_Cheese++;
Debug.Log("Blue Cheeses: " + Blue_Cheese);
BlueCheeseText.text = "Blue Cheese: " + Blue_Cheese;
}
}
}