Hey I am new to unity and currenlty working on a pixel 2D game. 
I am trying to create a system that when the player is colliding within a certain radius of an enemy, he gets scared.
I’ve written the scared function but I do not know how to make the code detetc collisiuon within a raduis and thus triggering the function on a different script.
help please ! 
var hitColliders : Collider2D[] = Physics2D.OverlapCircleAll(transform.position, whateverFloatYouWantAsRangeRadius, 1 << LayerMask.NameToLayer("Player")//I believe this will return the player if it's layer name is "Player");
This won’t take into account walls or things that block vision, so you will have to do something to do something different to test for that and requires a lot more than can fit in a forum here; however I use this tool and I can setup a 2D radius (with a check for minimum visibility too) in about 30 seconds and recommend it for everyone because it just saves a ton of time.