Here is my MySingleton.js javascript with code.I am getting errors mentioned at bottom of code.Need a Score var to be updated in other class where i am accessing it.Please don't mind my stupidity in code as am a newbie....:)Thanks in advance.
public class MySingleton { private static MySingleton instance;
public MySingleton ()
{
if (instance != null)
{
Debug.LogError ("Cannot have two instances of singleton. Self destruction in 3...");
return;
}
instance = this;
}
public static MySingleton Instance
{
get
{
if (instance == null)
{
new MySingleton ();
}
return instance;
}
}
private int score;
public int Score
{
get
{
return score;
}
set
{
score = value;
}
}
}
And the Error I am getting is:Assets/Test/MySingleton.js(3,20): BCE0043: Unexpected token: MySingleton.
Assets/Test/MySingleton.js(5,12): BCE0043: Unexpected token: MySingleton.
Assets/Test/MySingleton.js(5,24): BCE0044: expecting EOF, found '('.