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/Pizza_Script.cs

29 lines
521 B

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using TMPro;
public class Pizza_Script : MonoBehaviour
{
private int Pizza = 0;
[SerializeField] private TMP_Text PizzaText;
private void OnTriggerEnter2D(Collider2D collision)
{
if (collision.gameObject.CompareTag("Pizza"))
{
Destroy(collision.gameObject);
Pizza++;
Debug.Log(Pizza);
PizzaText.text = "" + Pizza;
}
}
}