How do I use an objects own coordinates within a script component placed on it and a few more questions related

I am very new to this so sorry if I’m an idiot

First off, see the title, I’m sure its simple but I have no idea.

I’m making a 2D game in which I need the player to be able to click on a tile, and then they would be moved to the middle of that tile, or exactly on the tiles coordinates and I have no idea where to start. I’ve tried looking it up but I can’t find anything that tells me how to move an object from a different objects script and how to get the base objects coordinates inside its own script to use.

Here is an example video on moving objects. I’m still going to answer your questions (at least some of them), but it’s clear you didn’t really watch any tutorial and probably didn’t look for any because your title question is literally a first thing you are told in basic tutorials including those on Unity official site.


  1. To get objects own position use this.transform.position.
  2. To get another objects position you have to have a reference to it. You can either find it dynamically with code or you can simply create a public GameObject field and drag that other object in the inspector window. Then you can do otherGameObject.position to get it’s coordinates just like with your gameObject.
  3. To learn how to use TileSystem you should watch some tutorials, there are plenty and I would recommend CodeMonkey or Brackeys. They both have amazing tutorials and CodeMonkey even has a whole ongoing series where he teaches absolute basics of Unity