- Home /
Parsing error. No idea what it is or what the problem is.
I get this error:
Assets/Nathansassets/Game Music.cs(1,28): error CS8025: Parsing error
Whenever I try to compile this C# script.
private static var instance: MyUnitySingleton
public static function GetInstance() : MyUnitySingleton {
return instance;
}
function Awake() {
if (instance != null && instance != this) {
Destroy(this.gameObject);
return;
} else {
instance = this;
}
DontDestroyOnLoad(this.gameObject);
}
I have no idea what the problem is, to me the code seems almost flawless.
It is almost flawless. Unfortunately, the compiler requires it to be completely flawless.
Answer by Waz · Jul 12, 2011 at 03:19 PM
That's JavaScript. Your filename is .cs
Eh, I made this question when I was tired. I just realized that.... Thanks haha.
Sometimes it just takes an extra pair of eyes, however tired. 2am here ;-)
Answer by almo · Jul 12, 2011 at 02:22 PM
Maybe a private static var instance needs an initializer like this?
private static var instance: MyUnitySingleton = null;
No, sorry. When I copied the code I missed the semicolon.
Your answer
Follow this Question
Related Questions
CS8025 Parsing error 3 Answers
Parsing error in C# 2 Answers
I can't figure why I'm getting a parsing error with my C# Code. 1 Answer
Parsing Error 2 Answers
I am having a parsing error in a C# pause script, can anyone help? 1 Answer