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 Cyber-X-Zone · Sep 22, 2012 at 05:32 PM · cameraguierror

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

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....

Comment
Add comment · Show 1
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 aldonaletto · Sep 23, 2012 at 01:20 AM 0
Share

The Start code is wrong. isCompany.Time.timeSinceLevelLoad doesn't exist (Time isn't part of isCompany), and even if it existed, Start would never execute at exactly 10.0 seconds after level loading. What exactly do you want this code to do?

1 Reply

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

Answer by eatsleepindie · Sep 23, 2012 at 12:37 AM

 if(isCompany.Time.timeSinceLevelLoad = 10.0)

should be

 if(isCompany.Time.timeSinceLevelLoad == 10.0)

in general (and I mean very general) terms, = is used to set a variables value, == is used in conditional statements to compare values.

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 aldonaletto · Sep 23, 2012 at 01:16 AM 0
Share

Actually, there are other errors: Time doesn't belong to GameObject, thus isCompany.Time will produce another error.

avatar image Cyber-X-Zone · Sep 24, 2012 at 12:17 PM 0
Share

thanx a lot...really thank you

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

11 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

Related Questions

GUI script still shows GUI on different camera 1 Answer

How to lerp between cameras on a UI button click? 2 Answers

what is the compile error on this script? 2 Answers

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

Bool script error 1 Answer


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