unity detect every time object goes up on y axis

My gameObject moves upwards constantly, and i want to spawn an object from that gameobject everytime it moves 3.0 up on the y axis. How do i do that?

void Update() { if(transform.position.y % 3 == 0) { spawn object } }