x


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)
}
more ▼

asked Oct 25 '10 at 11:01 AM

Brandon 5 gravatar image

Brandon 5
11 2 2 3

(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 '10 at 11:55 AM

Mike 3 gravatar image

Mike 3
32.4k 17 78 278

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 '10 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 '10 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

By RSS:

Answers

Answers and Comments

Topics:

x2984
x1477
x249
x39

asked: Oct 25 '10 at 11:01 AM

Seen: 2429 times

Last Updated: Oct 25 '10 at 11:01 AM