I created a Unity Script for my main camera but error popped up again and again… I want to add the main menu with the presenting and attractive style but Unity is showing that there are errors…
Here’s the code:-
// Make the script also execute in edit mode
@script ExecuteInEditMode()
var cyberXZone : Transform;
var background : Texture2D;
var skin : GUISkin;
private var isCompany = cyberXZone.renderer.enabled == false;
private var isLoading = false; // if true, we'll display the "Loading..." message.
function Start()
{
isCompany = true;
company = Instantiate(cyberXZone);
company.transform.position = new Vector3(20.14709,5.569142,12.45592);
if(isCompany.Time.timeSinceLevelLoad = 10.0)
{
isCompany = false;
while(timer < fadeTime)
{
tunnelAudio.volume = Mathf.Lerp(0, tunnelVolume, timer / fadeTime);
timer += Time.deltaTime;
yield;
}
}
}
function OnGUI()
{
if(isCompany == false) {
if (skin)
GUI.skin = skin;
else
Debug.Log("GUI Skin object missing!");
var backgroundStyle : GUIStyle = new GUIStyle();
backgroundStyle.normal.background = background;
GUI.Label ( Rect( (Screen.width - (Screen.height * 2)) * 0.75, 0, Screen.height * 2,
Screen.height), "", backgroundStyle);
GUI.Label ( Rect( (Screen.width/2)-197, 50, 400, 100), "Car Race",
"mainmenutitle");
if (GUI.Button( Rect( (Screen.width/2)-70, Screen.height - 160, 140, 70), "Play"))
{
isLoading = true;
Application.LoadLevel("1"); // load the game level.
}
var isWebPlayer = (Application.platform == RuntimePlatform.OSXWebPlayer ||
Application.platform == RuntimePlatform.WindowsWebPlayer);
if (!isWebPlayer)
{
if (GUI.Button( Rect( (Screen.width/2)-70, Screen.height - 80, 140, 70), "Quit"))
Application.Quit();
}
if (isLoading)
GUI.Label ( Rect( (Screen.width/2)-110, (Screen.height / 2) - 60, 400, 70),
"Loading...", "loading");
}
}
Error is:-
Assets/main menu-car.js(16,39): BCE0044: expecting ), found ‘=’.
(Filename: Assets/main menu-car.js Line: 16)
Assets/main menu-car.js(16,41): BCE0043: Unexpected token: 10.0.
(Filename: Assets/main menu-car.js Line: 16)
Assets/main menu-car.js(18,27): BCE0044: expecting :, found ‘=’.
(Filename: Assets/main menu-car.js Line: 18)
I hope someone can help me…And thank you in advance…