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
0
Question by Capn J · Aug 20, 2011 at 04:09 AM · getcomponentupgradebce00193.43.3

Issues with 3.3 to 3.4 javascript update

i use getComponent somewhat regularly and once upgraded to 3.4 everything seems to blow up. I did see the JavascriptGuide with the release notes but i'm havin issues figuring it out in this situation:

    var UnlockedLevelObject;//set up empty variable for a gameObject
 
 
 function Start () {
     UnlockedLevelObject = GameObject.Find("LevelCarrier");//fill the empty variable with instantiated gameObject
 
     var LevelCarrierObject : LevelCarrier = UnlockedLevelObject.gameObject.GetComponent(LevelCarrier);//access variable in found gameObject above
     LevelCarrierObject.LevelToPlay = 0;//set variable insode that gameObject
 }

Thoughts?

Comment
Add comment · Show 7
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 FTheCloud · Aug 20, 2011 at 04:43 AM 0
Share

Yeah, downgrade to unity 3.3 until 3.4 is more stable.

avatar image Capn J · Aug 20, 2011 at 04:47 AM 0
Share

will 3.3 publish to Android 3.0 devices?

avatar image Joshua · Aug 20, 2011 at 04:59 AM 0
Share

There's no way to help you if you don't specify the problem you are having. The code you posted above works perfectly fine, compiles and runs without errors and as expected.

@FTheCloud 3.4 is only unstable on windows, which should be fixed with the release of 3.4.1 in the co$$anonymous$$g week. The problem he is having seems to be unrelated to this however, so I don't see why you think it's useful to suggest downgrading.

avatar image Capn J · Aug 20, 2011 at 05:07 AM 0
Share

The script above compiles fine in 3.3, but in 3.4 is throws this(I make calls like this quite a bit so i get $$anonymous$$ANY of the same errors)

Asset/Scripts/test.js(7,69): BCE0019: 'gameObject' is not a member of 'Object'.

i think it has something todo with this:

http://unity3d.com/unity/whats-new/unity-3.4#javascript-upgrade-guide

avatar image Joshua · Aug 20, 2011 at 05:12 AM 0
Share

I've tested this script, even a second time just now just to make sure, and it compiles and works just fine - on 3.4 of course. I've had to create a gameobject and a .js named LevelCarrier of course, with a single variable int named LevelToPlay, to make it all work.

From your error it would seem it's having issues with Unity's API DLL's. Try putting both scripts in a folder in the root of your project named "Standard Assets" to see if this fixes it, since scripts in this folder are compiled earlier and have elevated privileges. If this doesn't fix it, try re-installing Unity.

It's definitely not a problem with your code.

Show more comments

1 Reply

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

Answer by Eric5h5 · Aug 20, 2011 at 05:25 AM

You shouldn't use untyped variables, such as "var UnlockedLevelObject;". You should supply the type either explicitly or by using a value. (e.g., "var foo = 5;" is fine because it derives the type (int) by the fact that you supplied an int as a value.) In this case, the type should be GameObject.

You should specify whether you're doing iOS/Android programming, because in that case, Unity 3.4 adds an invisible "#pragma strict" to all scripts. This doesn't happen if you're doing web/Mac/PC programming. So "this code doesn't work in Unity 3.4" isn't really true--in some cases it does, in some cases it doesn't. (As an aside, you'll find coding easier if you follow the convention of using lowercase for variable names, leaving uppercase for classes and functions.)

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 Joshua · Aug 20, 2011 at 05:27 AM 0
Share

Clever, I forgot about the new invisible #pragma strict and only tested for normal.

avatar image Capn J · Aug 20, 2011 at 05:55 AM 0
Share

@Eric5h5 - Thx man, 3.3 made me lazy, i went in a specified my types and everything is good

@Joshua - Thx for the help mate, and after seeing what 3.4 did to my game's performance...holy &^. Game is running and instantiating on the Android wicked fast, just need to test on a 3.0 device and i'm ready for an update.

Thx again fellas.

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Upgrade from 3.3 to 3.4 physics problems 0 Answers

BCE0019: is not a member of 'UnityEngine.Component' when trying to Build and Run iOS Unity 2 Answers

Upgrading to Unity 3.4 question 1 Answer

Unity 3.0 help mee 4 Answers

Why am I getting this error when accessing a variable or function on my script using GetComponent - 'x' is not a member of 'UnityEngine.Component'? 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