Make Enemy Solid Object

I have a cube set up as a collider in order to do damage when the character touches it. However, this means he goes through him. I have a rigidbody attached, but I can’t have it behave as a collider if it’s solid. Is there a right way to do this?

Turn off the “Is Trigger” flag and and instead use OnCollisionEnter() to catch the contact. This will allow the player to be hurt by the enemy but the player will not go through the enemy.

if for some reason you want both a trigger and a collider (just touching for damage wouldnt need one but like a radius around him that hurts you just being near for example)

if you want that you can attach an empty game object with a trigger and size it and then have the collider be the thing attached to him and the trigger just an empty object that follows him around