I need a script that whenever an object’s Y position is below 1, it will set the Y position back to 1.
Create a new script, and make its Update method look like this:
if (transform.position.y < 1) {
transform.position = new Vector3(transform.position.x, 1, transform.position.z);
}
Then attach this to your object. That should do it.
1 Like
Thanks! Haha, the only thing I left out in my old code was to put “new” before “Vector3”.