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 YM_Industries · Oct 13, 2011 at 12:35 AM · javascriptnetworking

Networking Example has lots of errors in Unity 3.4

Normally I'm quite good at fixing errors myself, but these ones are just too strange. All of these errors are Unknown Identifier errors. Did something in the JS scripting engine change recently? I think I last used the example in Unity 3.0 and it worked then.

I'm getting lots of errors that don't make sense, like:

 for(i=0;i<4;i++)

Unknown Identifier: i

Is my MonoDevelop corrupted?

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

1 Reply

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

Answer by Bunny83 · Oct 13, 2011 at 12:43 AM

If you referring to a special example project it would help to include a link to it or at least post a bit more code and even more important the name or extention of the script file.

The first line "could" compile without the strict pragma but i'm not sure, i don't use UnityScript. However if this script is writting in Unityscript just add the var keyword like this:

 for(var i = 0; i < 4; i++)


The second line is clearly C# and not UnityScript (Javascript). Are those two lines from the same script? What's the complete error?

As i've mentioned several times on other questions always include also the code before the error. Semicolon errors usually comes from a missing bracket or something like that.

Comment
Add comment · Show 7 · 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 YM_Industries · Oct 13, 2011 at 12:48 AM 0
Share

Both errors are from the same script, but the second error was on a line I wrote while trying to fix the error. I am used to C#, not JS but thought variable declarations were the same. (From looking at the rest of the script) Adding var before the i worked! Thanks. There are a few other errors that I will try to solve now.

avatar image YM_Industries · Oct 13, 2011 at 12:49 AM 0
Share

Just changed it to no longer be strict and all my errors went away. Has something changed in the strictness? Because that code used to work...

avatar image Bunny83 · Oct 13, 2011 at 01:08 AM 0
Share

Yep, as far as i remember they made some more things strict, but as i said i don't use UnityScript so i can't really tell ;)

Variable declarations looks different than in C#:

 // Dynamically typed var (very slow due to needed typecasting)
 var myVar;
 
 // statically typed var
 var myVar : int;
 var myVar : GameObject;
 
 // also statically typed due to type-inference
 var myVar = 5;  // type will be "int"
 var my$$anonymous$$esh = new $$anonymous$$esh(); // type will be "$$anonymous$$esh"
avatar image YM_Industries · Oct 13, 2011 at 01:12 AM 0
Share

Ah, thanks, that helps heaps. I don't think I'll use strict though :D

avatar image YM_Industries · Oct 13, 2011 at 01:27 AM 1
Share

NV$$anonymous$$, just read: "The benefits are improved error checking and more efficient code generation leading to faster execution times"

Show more comments

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Multiplayer Problems 1 Answer

Please, help me translating these to C# 1 Answer

How to retrieve current stock market prices? 2 Answers

OnGUI not recognizing variable change 1 Answer

Do static variables carry values between Clients? 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