what to use instead of destroy unity code example
Example 1: how to destroy in unity
// To remove a GameObject use the function 'Destroy()'
Destroy(gameObject);
Example 2: how to make a destroy reference in unity
private void OnMouseDown()
{
Destroy(gameObject);
}