How to keep gameobjects from instantiating on each other

I have a script that instantiate’s tetris like pieces on a plane. There are multiple types of pieces I have stored in an array. I have an empty game object that I use as the source for where I instantiate the pieces from the array. Once I instantiate the piece, it follows my cursor until I let up on the button. Once I let up on the button it places the tetris piece on the plane.

The game is to stack these pieces next to each other so it encloses an area. My problem is that I can’t figure out how to not allow the tetris piece to be placed on top of each other. Yet still retain the ability to stack right next to another piece. An also keep the ability for the object to follow my cursor until let up on the button and place it.

I tried OnTriggerenter and exit but its to generic and I can’t fine tune it enough to work in my situation.

Any Idea how I might do this? I am stumped:(

The instantiate command uses an [if] condition for instantiating your command.

Likely, you have made a command where you press the button (preferably “Fire1” which is CTRL or LMB) to instatiate objects.

The problem is, that the Engine is not understaning what you wanna say.

I eventually spotted the mistake in your code.

The mistake you did was that you entered GET BUTTON DOWN in the code

What it does is that it recognises the button once you press the button and keeps on the command …

If you change it with GET BUTTON UP , you can easily press one button once for instantiation.

Hoping it fixes it for you,

~FORSAKEN