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 COLLAnitySV · Nov 15, 2011 at 02:22 PM · errorgetcomponentdebugitweendoor

What does this mean ?

when i'm making script to enable doorTween onTriggerEnter i always got this message.

 var doorTween : DoorTween; //DoorTween is a script
 var doorStates : DoorState;
 enum DoorState {Open,Closed}
 function Open(){
 doorTween.enabled = true;
 doorStates = DoorState.closed;
 }

Assets/Standard Assets/Scripts/General Scripts/Door.js(3,17): BCE0018: The name 'DoorTween' does not denote a valid type ('not found').

what does that mean ? and also sometimes i got this message

 ArgumentException: You are not allowed to call get_gameObject when declaring a variable.
 Move it to the line after without a variable declaration.
 Don't use this function in the constructor or field initializers, instead move initialization code to the Awake or Start function.
 UnityEngine.Component.GetComponent (System.String type) (at C:/BuildAgent/work/842f9557127e852/Runtime/ExportGenerated/Editor/UnityEngineComponent.cs:126)
 Door..ctor () (at Assets/Standard Assets/Scripts/General Scripts/Door.js:3)
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 LeeGibson · Nov 15, 2011 at 03:55 PM 0
Share

try declaring var doorTween as public; that should show the variable in the inspector so you can put the DoorTween script in. i take it that the code you posted starts with line 17?

avatar image COLLAnitySV · Nov 16, 2011 at 08:22 AM 0
Share

no, this script is shorter line 17 was : doorTween.Open(); and on DoorTween(Script) has function OpenDoor(){ iTween.rotateTo(gameObject, {"y":76.8653, "time":3.0}); }

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by Bunny83 · Nov 15, 2011 at 04:17 PM

You have your "Door script" in "Standard Assets". That means it's compiled before all regular scripts (all scripts outside of Standard Assets or plugins). So scripts in Standard Assets can't use "normal" scripts. You should either move your Door script out of Standard Assets or put the other script into Standard Assets.

For more information on that subject see the manual (compilation order)

Your second exception happens because you can't call a function when you initialize a script variable. Shortcut properties like ".transform" or ".renderer" are just function calls behind the scenes (they use GetComponent). You have to declare your variables without a value and assign the value in Start (That's actually exactly what the error message suggests):

 // UnityScript
 // THIS WON'T WORK: Here you will get the error
 var myVariable : Renderer = renderer;
 
 // That's how you should do it:
 var myVariable : Renderer;
 
 function Start()
 {
     myVariable = renderer;
 }


Comment
Add comment · Show 1 · 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 COLLAnitySV · Nov 16, 2011 at 09:48 AM 0
Share

when i change it. i've got another problem NullReferenceException: Object reference not set to an instance of an object FPSInputController.Update () (at Assets/S$$anonymous$$IPPER'S/Scripts/FPSInputController.js:43) on line 43, i assign it's doorScript enumeration, on editor i've assigned the doorscript to Door. but when i'm play it, doorScript become none(door) i also move FPSInputController to another folder, if i move it to default place (Standart Asset) i've got the same message : Assets/Standard Assets/Character Controllers/Sources/Scripts/FPSInputController.js(6,25): BCE0018: The name 'Door' does not denote a valid type ('not found').

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

GetComponent Editing Variables not working in 3.5? 0 Answers

The type or namespace name `RigidbodyFirstPersonController' could not be found? 1 Answer

Scripting issue with opening a door with a key. 2 Answers

Instantiate Prefabs. Errors. 2 Answers

My game won't run on the cloud 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