Collision between two instances of the same object

Hello! I’m writing code for a SimCity-type game. I have classes for each building you can place, and a script that detects if collisions between buildings occur. If a collision occurs, it prevents the user from placing the building (because buildings can’t go on top of each other!).

I’m having trouble getting this collision script working though, could someone give me some advice on how to write the logic for this script and how to implement it?

To clarify, I’m not tryin to get someone to do the work for me >_> I already wrote the script and posted a question on UA, but wasn’t able to fix the code I had. The issues I was having are detailed there, but I’m looking to just start over from scratch with some fresh advice/guidance.

Thank you kindly!

not too hard

create empty
addcomponent collider
istrigger = true

keep this object ALWAYS ON
just move it around with the mouse its going to be a clone of the movemnt of the building
when you spawn it and allow movement, except it always exists and always moves

canspawnstuff = true

ontriggerenter

canspawnstuff = false

ontriggerstay

canspawnstuff = false

ontriggerexit

canspawnnstuff = true

make sure you have the ontriggerstray
you dont want to have 2 buildings inside your spawn radius

you move one out it makes it possible to spawn stuff
but there is still an object int ehre
this way you reset to false if another object is still in there