Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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
0
Question by thatnewguy · Jun 11, 2013 at 03:20 AM · guierrorcompile-error

what is the compile error on this script?

I have been stuck forever (I am not a good scripter) on what the compile error is on this script. can anybody tell me what im doing wrong? // JavaScript function OnGUI () { // Make a background box GUI.Box (Rect (10,10,1000,500), "Menu");

     // Make the first button. If it is pressed, Application.Loadlevel (1) will be executed
     if (GUI.Button (Rect (20,40,1000,20), "Desert")) {
         Application.LoadLevel (1);
     }
 
     // Make the second button.
     if (GUI.Button (Rect (20,70,1000,20), "Mountains")) {
         Application.LoadLevel (2);
     }
     
     // Make the third button.
     if (GUI.Button (Rect (20,100,1000,20), "Third")) {
         Application.LoadLevel (3);
     }
 }

EDIT: I do not think I have been clear enough that there is no error message I can find. he is a picture of my problem:

[1]: /storage/temp/11929-error.png

error.png (135.4 kB)
Comment
Add comment · Show 14
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 robertbu · Jun 11, 2013 at 03:22 AM 3
Share

Compiles and runs for me. Any chance you authored it inside a C# script file ins$$anonymous$$d of a Javascript file? It always helps us figure out what is going on if you copy and past the error message from the Console in Unity.

avatar image Benproductions1 · Jun 11, 2013 at 10:39 AM 1
Share

smug: I get a compile error on line 1... "I" is not defined :P

avatar image Ben-Stoneman ♦♦ · Jun 11, 2013 at 10:56 AM 0
Share

Are the scenes added to your "Build Settings" window?

avatar image Leslie-Young · Jun 11, 2013 at 11:44 AM 0
Share

You really should copy/paste the error message you are getting from the Unity console too as it will help us better help you. Like Ben mentioned above, are there at least 4 scenes in your Build Settings? That seems like the most likely reason to get an error in the code snippet you posted.

avatar image thatnewguy · Jun 11, 2013 at 11:43 PM 0
Share

@Robert, it is in javascript... @ben, A: that is me messing up on the code into this, not the actual script. B: Build Settings? @leslie, I do not get an error, but when I hit play, the scene comes up with: All compiler errors have to be fixed before entering playmode!

Show more comments

2 Replies

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by SubatomicHero · Jun 12, 2013 at 02:09 PM

So it looks like you probably copied and pasted your script from somewhere else? This error is thrown when there is some form of white space garbage sat in your script that you simply cannot see.

My advice is to create a new script and type copy (don't copy and paste) the script over to your new script and use that one.

Comment
Add comment · Show 2 · 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 thatnewguy · Jun 13, 2013 at 11:57 PM 0
Share

I did that, but now the actual GUI wont show up

avatar image thatnewguy · Jun 14, 2013 at 02:21 AM 0
Share

never $$anonymous$$d, I got it to work! thanks!

avatar image
0

Answer by Slobdell · Jun 14, 2013 at 12:03 AM

I've had issues with MonoDevelop lately, things like instantiating a Vector3 array, and then further down in my script when I try to do something with it Mono is telling me it's a Vector3, not a Vector3 array. Usually fixes if I clean and build again, sometimes restart Mono. Try that maybe...

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

21 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

GUI Scale Problem 1 Answer

Error: you are pushing more GUIClips than you are poping. 1 Answer

Bool script error 1 Answer

A GUI error in script??? HELP,Please!! 1 Answer

Tracking Down GUI Errors 0 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