Maybe I'm just doing this wrong, but I'm looking for a raycast to get a tile and then place a prefab at the location of that tile.
function Update()
{
if(Input.GetMouseButtonDown(0))
{
var ray : Ray = Camera.main.ScreenPointToRay(Input.mousePosition);
var hit : RaycastHit;
if(Physics.Raycast(ray, hit, 1000))
{
print(hit.point);
print(Input.mousePosition);
print(hit.transform);
if(hit.transform.tag == "TileMap")
{
print("Yes!");
Resources.Load("TileMap");
GetTileAtPosition(hit.point);
var createGrunt : GameObject = Instantiate(Resources.Load("SpriteGrunt", GameObject), hit.point, transform.rotation);
}
}
}
}
I feel like I have no clue what I'm doing. How do I properly use GetTileAtPosition?