up and down detect

how in script to detect if the object was moved within y axis?, i have a gameobject that should be moved up and down

In general, store the last position in a variable and check if the distance from the current position is greater than an epsilon. In your case, just do it with the y component.