creating an object inside a trigger

I’ve ran into an issue that I can’t seem to solve.
I am trying to activate the OnTriggerEnter() and the OnTriggerExit() methods of a trigger by creating and destroying an object at the exact location of the trigger.I want to check if a specific area in the game is being occupied by a specific type of object. The problem is that the trigger doesn’t seem to work when the object gets created or destroyed.
The game is “Minecraft-like”, which means that objects can only be created in specific locations(grid-like positions) and cannot be picked up and moved. I can include some of the code I wrote, if you consider that it might help, though I hope I’ve explained the problem well enough.
Any help would be greatly appreciated.

I’m not exactly sure what you mean by “I am trying to activate the OnTriggerEnter() and the OnTriggerExit() methods of a trigger by creating and destroying an object at the exact location of the trigger.”

But if you “want to check if a specific area in the game is being occupied by a specific type of object” in a “Minecraft-like” game where “objects can only be created in specific locations(grid-like positions) and cannot be picked up and moved”, why not make the trigger a child of the object you want to collide with, or a separate game object with the renderer disabled? That way you can move the trigger around, and not change the integrity of the grid.

In honesty though, I’m not 100% sure what you’re getting at. If you could explain the situation better maybe I can give a better answer.

Okay, more specifically, I am trying to figure out if a building of a certain shape is being built. I am procedurally generating a hologram like object that acts like a trigger and then checking to see if it has been filled completely with bricks. The problem is that it does not respond when a brick is being placed inside(a.k.a created).

Ah, I see.

Perhaps try OnTriggerStay? It might be that the OnTriggerEnter is not being called as it is being created inside, although I’m not positive.

EDIT:
The only other solution I can think of is storing a hard-coded 2 dimensional array corresponding to the shape of the building you want to check for. You could then check your block data for that pattern, perhaps. (Although, using Unity’s predetermined colliders will probably be much easier and more visual).