Amongst other things, I am trying to get a handle on static typing and #pragma strict. This script worked in my Web Player version with no errors, Errors in IOS version though. So I suspected it was my use of dynamic typing. Or more accurately my lack of using #pragma strict. I get the following error; Assets/Scripts/NextLevel.js(9,70): BCE0019: ‘score’ is not a member of ‘UnityEngine.Score’. This is on the code just below.
static var nextLevel :String;
var customSkin :GUISkin;
function OnGUI()
{
GUI.skin = customSkin;
GUI.BeginGroup(Rect(Screen.width / 10, Screen.height / 2.5, 200, 200));
GUI.Box(Rect(0,0, 200,200), "Round Over");
GUI.Label(Rect(40,40,200,50), "Your total score is " + Score.score.ToString());
if(GUI.Button(Rect(50,80,100,50), nextLevel))
{
Application.LoadLevel(nextLevel);
}
if(GUI.Button(Rect(50,140, 100,50), "Quit"))
{
Application.Quit();
Application.OpenURL("http://www.myWebPage.com");
}
GUI.EndGroup();
}
Here is my associated Score script’:
static var score :int;
static var lastScore :int;
var customSkin :GUISkin;
function OnGUI ()
{
GUI.skin = customSkin;
GUI.Label(Rect(10,10, 100, 60), "Score: " + score.ToString());
GUI.Label(Rect(10,60,100,60),"Last Score: " + lastScore.ToString());
}
Can someone please tell how I can correct this problem? I may be wrong in approaching it as a static typing problem but have no idea how to fix it.
Thanks a googol…