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 archie_azares · Aug 14, 2013 at 05:49 PM · javascriptsemicolon

I am getting an error I don't understand

I'm getting this error: UCE001 ';' expected in line 213:23 in the part of var parseFloat(object.toString(t));

Can anyone help me figure out? This is my code below:

 var fpsCounter : FPSCounter;
 var terrain : Terrain;
 var messageTime = 10.0;
 var scrollTime = 0.7;
 
 private var messages = new Array();
 private var times = new Array();
 private var lastTime = 0.0;
 private var doneNotes = false;
 private var origDetailDist = 0.0;
 private var origSplatDist = 0.0;
 private var origTreeDist = 0.0;
 private var origMaxLOD = 0;
 private var softVegetationOff = false;
 private var splatmapsOff = false;
 
 private var lowFPS = 15.0;
 private var highFPS = 35.0;
 
 private var skipChangesTimeout = 1.0;
 private var nextTerrainChange = 0;
 
 function Start()
 {
     if( !fpsCounter || !terrain ) {
         Debug.LogWarning("Some of performance objects are not set up");
         enabled = false;
         return;
     }
     
     origDetailDist = terrain.detailObjectDistance;
     origSplatDist = terrain.basemapDistance;
     origTreeDist = terrain.treeDistance;
     origMaxLOD = terrain.heightmapMaximumLOD;
     skipChangesTimeout = 0.0;
     
     var distances : float[] = new float[32];
     distances[16] = Camera.main.farClipPlane;
     Camera.main.layerCullDistances = distances;
 }
 
 function Update ()
 {
     if( !fpsCounter || !terrain )
         return;
         
     if( !doneNotes && !Application.isEditor )
     {
         var gfxCard = SystemInfo.graphicsDeviceName.ToLower();
         var gfxVendor = SystemInfo.graphicsDeviceVendor.ToLower();
         if( gfxVendor.Contains("intel") )
         {
             // on pre-GMA950, increase fog and reduce far plane by 4x :)
             softVegetationOff = true;
             QualitySettings.softVegetation = false;
             AddMessage( "Note: turning off soft vegetation (Intel video card detected)" );
         }
         else if( gfxVendor == "sis" )
         {
             softVegetationOff = true;
             QualitySettings.softVegetation = false;
             AddMessage( "Note: turning off soft vegetation (SIS video card detected)" );
         }
         else if( gfxCard.Contains("geforce") && (gfxCard.Contains("5200") || gfxCard.Contains("5500") || gfxCard.Contains("6100")) )
         {
             // on slow/old geforce cards, increase fog and reduce far plane by 2x
             ReduceDrawDistance( 2.0, "Note: reducing draw distance (slow GeForce card detected)" );
             
             softVegetationOff = true;
             QualitySettings.softVegetation = false;
             AddMessage( "Note: turning off soft vegetation (slow GeForce card detected)" );
         }
         else
         {
             // on other old cards, increase fog and reduce far plane by 2x
 //            if( hwWater == IslandWater.WaterMode.Simple )
 //            {
 //                ReduceDrawDistance( 2.0, "Note: reducing draw distance (old video card detected)" );
 //            }
         }
         
         skipChangesTimeout = 0.0;
         doneNotes = true;
     }
     
     DoTweaks();
     
     UpdateMessages();
 }
 
 function ReduceDrawDistance( factor : float, message : String )
 {
     AddMessage( message );
 //    RenderSettings.fogDensity *= factor;
 //    Camera.main.farClipPlane /= factor;
     var distances : float[] = Camera.main.layerCullDistances;
     for(var i : int = 0; i < distances.Length; i++)
         distances[i] /= factor;
     Camera.main.layerCullDistances = distances;
 }
 
 function OnDisable()
 {
     QualitySettings.softVegetation = true;
 }
 
 function DoTweaks()
 {
     if( !fpsCounter.HasFPS() )
         return; // enough time did not pass yet to get decent FPS count
     
     var fps : float  = fpsCounter.GetFPS();
     
     // don't do too many adjustments at time... allow one per
     // FPS update interval
     skipChangesTimeout -= Time.deltaTime;
     if( skipChangesTimeout < 0.0 )
         skipChangesTimeout = 0.0;
     if( skipChangesTimeout > 0.0 )
         return;
     
     // terrain tweaks
     if( fps > 25.0 )
     {
         // bump up!
         ++nextTerrainChange;
         if( nextTerrainChange >= 4 )
             nextTerrainChange = 0;
             
         if( nextTerrainChange == 0 && terrain.detailObjectDistance < origDetailDist )
         {
             terrain.detailObjectDistance *= 2.0;
             if( !softVegetationOff )
                 QualitySettings.softVegetation = true;
             AddMessage( "Framerate ok, increasing vegetation detail" );
             return;
         }
         if( nextTerrainChange == 1 && !splatmapsOff && terrain.basemapDistance < origSplatDist )
         {
             terrain.basemapDistance *= 2.0;
             AddMessage( "Framerate ok, increasing terrain texture detail" );
             return;
         }
         if( nextTerrainChange == 2 && terrain.treeDistance < origTreeDist )
         {
             terrain.treeDistance *= 2.0;
             AddMessage( "Framerate ok, increasing tree draw distance" );
             return;
         }
     }
     if( fps < lowFPS )
     {
         // lower it
         ++nextTerrainChange;
         if( nextTerrainChange >= 4 ) {
             nextTerrainChange = 0;
             lowFPS = 10.0; // ok, this won't be fast...
         }
             
         if( nextTerrainChange == 0 && terrain.detailObjectDistance >= origDetailDist / 16.0 ) {
             terrain.detailObjectDistance *= 0.5;
             QualitySettings.softVegetation = false;
             AddMessage( "Framerate low, reducing vegetation detail" );
             return;
         }
         if( nextTerrainChange == 1 && !splatmapsOff && terrain.basemapDistance >= origSplatDist / 16.0 )
         {
             terrain.basemapDistance *= 0.5;
             AddMessage( "Framerate low, reducing terrain texture detail" );
             return;
         }
         if( nextTerrainChange == 2 && terrain.treeDistance >= origTreeDist / 16.0 )
         {
             terrain.treeDistance *= 0.5;
             AddMessage( "Framerate low, reducing tree draw distance" );
             return;
         }
     }
     if(fps < 20)
     {
         if(QualitySettings.currentLevel > QualityLevel.Fastest)
             QualitySettings.DecreaseLevel();
     }
     else if(fps > highFPS)
     {
         if(QualitySettings.currentLevel < QualityLevel.Fantastic)
             QualitySettings.IncreaseLevel();
     }
     
     if(QualitySettings.currentLevel < QualityLevel.Good)
     {
         var sh : Shader = Shader.Find("VertexLit");
         var bumpedObjects : GameObject[] = GameObject.FindGameObjectsWithTag("Bumped");
         for(var i : int = 0; i < bumpedObjects.length; i++)
         {
             bumpedObjects[i].renderer.material.shader = sh;
         }
     }
 }
 
 function AddMessage( t : String )
 {
     messages.Add( t );
     times.Add( messageTime );
     lastTime = scrollTime;
     skipChangesTimeout = fpsCounter.updateInterval * 3.0;
 }
 
 function UpdateMessages()
 {
     var dt = Time.deltaTime;
     for( var t in times )
     var parseFloat(object.toString(t));  /////<-------- referring to this line here.
         t -= dt;
     while( times.length > 0 && times[0] < 0.0 ) {
         times.Shift();
         messages.Shift();    
     }
     lastTime -= dt;
     if( lastTime < 0.0 )
         lastTime = 0.0;
 }
 
 function OnGUI()
 {
     var height = 15;
     var n : int = messages.length;
     var rc = Rect( 2, Screen.height - 2 - n * height + (lastTime/scrollTime*height), 600, 20 );
     for( var i = 0; i < n; ++i )
     {
         var text : String = messages[i];
         var time : float = times[i];
         var alpha = time / messageTime;
         if( alpha < 0.2 )
             GUI.color.a = alpha / 0.2;
         else if( alpha > 0.9 )
             GUI.color.a = 1.0 - (alpha-0.9) / (1-0.9);
         else
             GUI.color.a = 1.0;
         
         GUI.Label( rc, text );
         rc.y += height;
     }
 }
 
Comment
Add comment · Show 2
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 hoy_smallfry · Aug 14, 2013 at 06:39 PM 0
Share

I've reformatted your answer. Take it as an example of how you want to post from now on.

avatar image archie_azares · Aug 14, 2013 at 09:23 PM 0
Share

This was from the car tutorial that i have imported and i was trying to move the car.. Am i doing wrong ?

TNX FOR ALL OF THE ANSWERS

4 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by IndieScapeGames · Aug 14, 2013 at 06:43 PM

You are using parseFloat as a method that's also initializing a variable. To do this properly, do the following:

 var floatDesired = parseFloat(object.ToString());


However, unless part of the default library, the parseFloat method that takes a string object is not in your code and you will get a different error.

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 Bunny83 · Aug 14, 2013 at 06:44 PM

Well, your line 213 makes not much sense:

  var parseFloat(object.toString(t));

The var keyword has to be followed by a variable name. Also the next line accesses the t variable but outside the for loop.

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

Answer by lancer · Aug 14, 2013 at 06:44 PM

You don't put an arguments into ToString(), you just type it like:

 SomeThingHere.ToString();
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 IgorAherne · Aug 14, 2013 at 06:42 PM

change to

 for( object t in times )
 var parseFloat(t.toString());  /////<-------- referring to this line here.
Comment
Add comment · Show 3 · 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 archie_azares · Aug 14, 2013 at 09:46 PM 0
Share

Assets/scripts/JavaScripts/PerformanceTweak.js(212,21): BCE0044: expecting ;, found 't'.

Assets/scripts/JavaScripts/PerformanceTweak.js(212,26): BCE0043: Unexpected token: times.

Assets/scripts/JavaScripts/PerformanceTweak.js(213,23): UCE0001: ';' expected. Insert a semicolon at the end.

Assets/scripts/JavaScripts/PerformanceTweak.js(223,1): BCE0044: expecting EOF, found '}'.

errors are keep on popping when i change it to object :(

avatar image Joyrider · Aug 14, 2013 at 09:48 PM 1
Share

I think he meant foreach(object t in times)

avatar image Bunny83 · Aug 15, 2013 at 07:44 AM 0
Share

He ment you should change your question to this since it's way too long. So this is not an answer and should be a comment.

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

23 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 avatar image avatar image

Related Questions

semicolon expected while semicolon is present 1 Answer

PhotonNetworking Colliders of players dont collide 0 Answers

The errors when I build my project for winphone 8 with electrotank library ! 0 Answers

How to get length of inner array in unityscript multidimesional array? 1 Answer

Add stuff to script by default when created 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