Код: Выделить всё
using UnityEngine;
public class BCE : MonoBehaviour
{
public Sprite poppedSprite;
public float destroyDelay = 1f;
private bool isPopped = false;
private void OnMouseDown()
{
// Change the sprite to the "popped" sprite
gameObject.GetComponent().sprite = poppedSprite;
// Set the flag indicating that the bubble has been popped
isPopped = true;
// Destroy the GameObject after a short delay
Destroy(this.gameObject, 0.1f);
}
}
Подробнее здесь: https://stackoverflow.com/questions/756 ... destroying