# Instantiate a GameObject in front of (snap to grid) my character

In a 2d top-down game, what would be the best approach to Instantiate a GameObject in front of my player as he moves around and I, for example, plant a tree.

I was thinking about creating a small trigger-collider that will always be 1 unit in front of my player, then get the Mathf.Round position of the ground-object that collider is currently overlapping, and place the tree there.

However the more I think about it the uglier that solution seems, is there some better way? Performance wise and just design wise. Maybe I could somehow get the wolrdposition of my player, his direction, and the amount of units in front I want to place the object (1), and Instantiate it there. But with this approach I cant check if I already planted a tree in the location, since I dont have a collider. i.e this approach would not know what GameObject is in front of the player.

Is my first approach okay or is there some better way?