A Unity ID allows you to buy and/or subscribe to Unity products and services, shop in the Asset Store and participate
in the Unity community.
Discussion in 'Scripting' started by luhjgh, Oct 1, 2011.
Its probably pretty simple, but I'm just wondering what function you would use for this.
Find the distance from your AI object and then play the sound.
float dist = Vector3.Distance(transform.position, ai.transform.position);
if (dist <= someValue)
// Play the sound
I assume ai is a GameObject that stores the object you call AI.