- Home /
Error CS8025 compiler error
I get an error message saying: Assets/Scripts 1/Audio upon death.cs(1.36): error CS8025: Parsing error
The script that i wrote is trying to get an audio file to play in it's entirety and re spawn my character when it finishes. Can anyone help me find the error? (soz i'm pretty new to scripting.)
public AudioClip "Death Song";
public float length 10;
void OnDeath(){
audio.PlayOneShot(Death Song);
Invoke("Respawn",length)
}
Answer by Mike 3 · Oct 25, 2010 at 11:55 AM
The top line is the one with the problem, you're trying to use a string literal as a variable name
Change it to something like this:
public AudioClip deathSong;
It'll let you assign the audio clip from the inspector after that
Same with the line below it. Or, you can put an equals sign before the constant in both cases. The variable will default to that value when the script is first assigned to an object, but after that whatever value you assign it in the Inspector will be the one that sticks.
You couldn't put an equals sign on the top line, there isn't a string to AudioClip conversion. But yeah, would work on the second line
Your answer
![](https://koobas.hobune.stream/wayback/20220613080734im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How to fix my code? (Player death + Respawn) 3 Answers
CS8025 parsing error 1 Answer
What Does error mean : i got it from this line of script...... 2 Answers
error CS8025: Parsing error (sorry) 4 Answers
Play sound, while press any key 3 Answers