Use a capsule collider as a trigger to change a boolean statement.

I have a zombie that seeks the player; however, I would like to use a capsule collider in order for the zombie to tell whether or not if the player is in attacking range. I just need to know how to detect the player colliding with the zombies collider, and for that to change a boolean attacking value to true when the player is colliding. If you can please provide a tutorial that is in c#. Thank you in advance!!

Hey! I’m extremely new to coding, so maybe I don’t understand the question fully, but I believe I can help you, and I want to give back to Unity Answers, as it’s helped me a lot!!!

I believe you want something like this

    OnTriggerEnter(Collider other)
    {
             if (other.gameObject.CompareTag("player"))
             {
                 attackBool = true;
             }
    }
    
    OnTriggerExit(Collider other)
    {
             if (other.gameObject.CompareTag("player"))
             {
                 attackBool = false;
             }
    }

Make sure on your player, in the inspector (near the top) you add the tag “player” to it, and the capsule collider is set as “trigger”

Sorry if I’m completely wrong, as I said, I’m new to this, but I think this does what you need, and I want to help if I can!