Complier Error unexpected char: 0xFEFF.

I am extreamly new to unity and hoping for some help and answers. I have created a box collider, trigger sound (script) and an audio source. Any help is much appreciated!

error:

Assets/Sounds/trigger sound.js(1,12): BCE0044: unexpected char: 0xFEFF.

Thia is the code I am using:

var sound : AudioClip;
function OnTriggerEnter()
{ audio.PlayOneShot(Sound);
}

1 Answer

1

Your variable name is sound, but you’ve told it to play a variable named Sound. Make sure the case is the same whenever using a variable.

Thank you! So would it just be the case of changing it to this? Sorry i'm really not very good at scripting. var sound : AudioClip; function OnTriggerEnter() { audio.PlayOneShot(sound); } I still have this error after changing the code: Assets/Sounds/trigger sound.js(1,12): BCE0044: unexpected char: 0xFEFF.

–