Before updating to Windows 10 you may need to return your Pro license. More information here

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);

more ▼

asked Oct 25, 2010 at 11:01 AM

avatar image

Brandon 5
11 6 4 5

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

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

more ▼

answered Oct 25, 2010 at 11:55 AM

avatar image

Mike 3
34.6k 28 156 319

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.

Oct 25, 2010 at 12:33 PM Bampf

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

Oct 25, 2010 at 01:16 PM Mike 3
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments



asked: Oct 25, 2010 at 11:01 AM

Seen: 2776 times

Last Updated: Oct 25, 2010 at 11:01 AM