I must be doing something wrong and am sure there is a simple solution but I’ve been searching for hours and every answer I find either throws up errors or Unity tries to update the script and fails. I can’t seem to get my audiosource to play in this script. Any help would be much appreciated this is driving me crazy!
#pragma strict
var rb: Rigidbody;
var PoliceSplash : AudioSource = GetComponent.<AudioSource>();
var PoliceDestroyed : int;
function Start () {
rb = GameObject.Find("Nightbrake Police Unit").GetComponent.<Rigidbody>();
}
function OnTriggerExit(collider : Collider)
{
if(collider.tag == "Water")
{
//EnableSplashPrefab
//Play Splash Sound Effect
yield WaitForSeconds(1);
rb.isKinematic = true;
print("A Police Car has driven into the water.");
PoliceDestroyed = PoliceDestroyed + 1;
}
}
function Update () {
}