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;
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
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
The best place to ask and answer questions about development with Unity.
To help users navigate the site we have posted a user guide.
If you are a new user, check out our FAQ for more information.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
For troubleshooting common problems with Unity 5.x Editor (including Win 10).
Answers and Comments
No one has followed this question yet.
What Does error mean : i got it from this line of script......
Null Reference exception help
Wierd error messages concerning audio play and pause?
CS8025 parsing error
[c#]Does audio.Play() work only in Update and Start funcitons?