Moving objects via Mouse and Touch on Y axis

I want to make an object move on only the Y-axis only, moving to a mouse click or touch. I want to make several objects do this so I how do i make each one separately move up and down and not at the same time when pressed above or below them. Sorry Im new at this :stuck_out_tongue:

Break your question down, and hit google. If there’s something you’re stuck with, hit google again. This is the basics of basics, and google has a zillion hits on all of these problems you might encounter.

Here’s a break down to feed your google:

  1. “Unity how to move a gameobject”
  2. “Unity move object along one axis”
  3. “Unity move gameobject to mouse position”
  4. “Unity get closest object”

Answering this with a complete script feels like working for free, and you haven’t learned a thing out of it.