Hi,
I’m working on a simple project,and I’m new to Unity. I want a cube to drop and the player must avoid it. Then, after the cube reaches Y<-4.5, I want it to teleport to Y: 5, and the X is to be a randomly generated value between -2 and 4. If someone could provide me with the code I’d need, that would be really great (:

Thanks in advance!

To facilitate your cube raining extravaganza please apply the following script to each cube:

void FixedUpdate() {
    if (transform.position.y < -4.5f) {
        transform.position = new Vector3(Random.Range(-2f,4f), 5f, transform.position.z);
    }
}