How to detect if an object is touching another?

I used the void OnCollisionEnter which did work but it worked if the object collided with another (for example if I moved cube1 and it hit cube2) while what I need right now is if cube1 is next to cube2 and is touching cube 2, then the action to happen.


OnCollisionStay is called once per
frame for every collider/rigidbody
that is touching rigidbody/collider.

I got the exact same problem too. i want to take damage from my enemy if the instantiate bullet touched the enemy. Couldn’t you do something like this;
void Update
if Bullet position float here = enemy position float here
PlayerDamage -= enemyHP
if EnemyHP = NULL
debug.log(“you’ve won!!!”)

measure the distance between the flagged object and player object, if its zero, then go a head and do the dmg calculation based on the flag parameter of dmg.