how to make scary sound if player look and close with enemy ?

BOO !!!

how to make scary sound if player look and close with enemy ?

how to play a sound when players see enemies and close to the players …?
and sound just spinning one time …
and when palyer does not see the sound being off …
and when players see the enemy, the sound comes back on?

allowing the player to shout / surprised …?

attach this to a cube , then make the cube tiny but make it have a large collider (this is the area in which the sound can be heard) then make it a trigger and child it to your enemy. On this game object you must have an audio source, also make sure your scene view camera is not on your enemy when you use renderer.isVisible your player should be tagged as Player

function OnTriggerEnter(other : Collider){

if(other.gameObject.tag == "Player" && renderer.isVisible){
audio.Play();
}
}