Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by Austin Schaeffer · Apr 09, 2010 at 10:48 PM · errorsyntax-erroruce0001

Lerpz tutorial multiple errors.HELP!!!!

I followed this part of the 3D platformer tutorial step by step for 1 hour(or more), and was sad when i got this many errors

script:

//Make the script also execute in edit mode @script ExecuteInEditMode()

var gskin : GUISkin; var backdrop : Texture2D; //Our backdrop image goes here private var isLoading = false; //if true, we'll display the "Loading..." message

function OnGUI() { if(gSkin) GUI.skin - gSkin; else Debug.Log("StartMenuGUI: GUI Skin object missing!")

var backgroundStyle : GUIStyle = new GUIStyle(); backgroundStyle.normal.background = backdrop; 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), "Lerpz Escapes", "mainMenuTitle");

if(GUI.Button( Rect( (Screen.width/2)-70, Screen.height - 160, 140, 70), "Play")) { isLoading = true; Application.LoadLevel("TheGame"); //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", "mainMenuTitle");

}

errors:

Assets/StartMenuGui.js(13,61): UCE0001: ';' expected. Insert a semicolon at the end.

Assets/StartMenuGui.js(17,75): BCE0044: expecting ), found 'Screen'.

Assets/StartMenuGui.js(17,81): BCE0044: expecting ), found '.'.

Assets/StartMenuGui.js(17,82): UCE0001: ';' expected. Insert a semicolon at the end.

Assets/StartMenuGui.js(17,92): BCE0043: Unexpected token: ,.

Assets/StartMenuGui.js(17,93): UCE0001: ';' expected. Insert a semicolon at the end.

Assets/StartMenuGui.js(18,14): BCE0043: Unexpected token: ).

Assets/StartMenuGui.js(18,19): BCE0043: Unexpected token: ,.

Assets/StartMenuGui.js(18,21): BCE0043: Unexpected token: backgroundStyle.

Assets/StartMenuGui.js(29,41): BCE0044: expecting ), found '='.

Assets/StartMenuGui.js(29,42): UCE0001: ';' expected. Insert a semicolon at the end.

Assets/StartMenuGui.js(30,67): BCE0043: Unexpected token: ).

Please help this is my first script ever and im trying my best to learn, and i shall never give up.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

4 Replies

· Add your reply
  • Sort: 
avatar image
3

Answer by Michael La Voie · Apr 09, 2010 at 10:56 PM

Here is your code re-posted in a clean format (this should help you get more answers):

//Make the script also execute in edit mode @script ExecuteInEditMode()

var gskin : GUISkin; var backdrop : Texture2D; //Our backdrop image goes here private var isLoading = false; //if true, we'll display the "Loading..." message

function OnGUI() { if(gSkin) GUI.skin - gSkin; else Debug.Log("StartMenuGUI: GUI Skin object missing!")

 var backgroundStyle : GUIStyle = new GUIStyle();
 backgroundStyle.normal.background = backdrop;
 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), "Lerpz Escapes", "mainMenuTitle");

 if(GUI.Button( Rect( (Screen.width/2)-70, Screen.height - 160, 140, 70), "Play")) { 
     isLoading = true; 
     Application.LoadLevel("TheGame"); 
     //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", "mainMenuTitle");

}

Debugging

Welcome to the world of debugging! A large part of programming is resolving typos and logic mistakes that you make while writing code. Unfortunately, i don't have time right now to resolve your whole problem (perhaps someone else does), but I can help you in the right direction.

Those errors you posted give you a big hint into where the problem is.

Take this one:

Assets/StartMenuGui.js(13,61): UCE0001: ';' expected. Insert a semicolon at the end.

The numbers (13,61) are a super-helpful hint. They tell you that the bug is on line 13 and the compiler's best guess is that the bug is near the 61st character.

In this case, look at your OnGUI function's first if...else... statement:

function OnGUI() { 
    if(gSkin) GUI.skin - gSkin; 
    else Debug.Log("StartMenuGUI: GUI Skin object missing!")

You can see that the else line doesn't end in a semicolon.

You should fix bugs one at a time, then re-compile to see the new error list until there are none.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by Skitzzen · Dec 23, 2010 at 12:58 AM

I just went to 30 diff. people complaining about this script, not ONCE did the people answering even consider putting the clean code up....THANK YOU MERRY CHRISTMAS... so many "expert" answers were wrong...you just told it like it was...ahhh now i can check VS my script

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by Skitzzen · Dec 23, 2010 at 01:02 AM

Nevermind this script is just as buggy...

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by monty · Apr 13, 2011 at 03:20 PM

i got this same problem in the gun code from the bootcamp demo and it says to go to character 46 but there are only 35 in that line on code. can anyone help with this?

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

1 Person is following this question.

avatar image

Related Questions

Insert a semicolon error 1 Answer

doing force and spin on a gameobject when clicking on plane. 2 Answers

Scripting error: ';' expected. Insert a semicolon at the end. 2 Answers

Using JavaScript and C# inside one script 2 Answers

UCE0001: ';' expected. Insert a semicolon at the end. 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges