So i am trying to A. count how many times a box goes into the goal when it hits a collider and B. when the counter gets up to 3 the mesh renderer of the box disappears. Can someone help me?
public class CubeMove : MonoBehaviour {
public GameObject Move;
public GameObject Pickup;
public GameObject New;
public int x = 0;
private void OnTriggerEnter(Collider other)
{
Move.transform.position = New.transform.position;
x = x + 1;
if (x = 3)
{
Destroy(Object.Pickup MeshRenderer);
}
}