- Home /
Raycast to Disable Script
I am trying to use RayCastHit to grab a specific script from certain objects, and disable them.
Hover over reverseGravity: "reverseGravity does not exist in the current context"
Hover over reverseGravity: "?"
Hover over var: "Unknown resolve error"
Could someone show me how to properly find and disable the scripts on these other objects, and explain why? I am used to Javascript and I am writing this in C# for practice.
Also, if you can explain the other two errors (given from hovering over car and reverseGravity), even if they are caused from the first problem.
I'm assu$$anonymous$$g you are talking about compile time errors? And is 'reverseGravity' the exact name of the class or script including the case of letters? It's not 'ReverseGravity' for example?
In C# you don't write var for initializing a new variable. So if you want to initialize a variable of type lightOn, your code would be: lightOn script = GetComponent(lightOn);
Are the reverseGravity and lightOn scripts written in JavaScript? If so, you will have to place them in a first pass folder like Standard Assets or Plugins. If they aren't JS, then check for errors in the name of the scripts.
@Evil Tak, I'm sorry, but that's just plain wrong. C# has a var
keyword and yes it's used for defining variables: http://msdn.microsoft.com/en-us/library/bb383973.aspx
Yes, the scripts are in Javascript. How do I add a script to the Standard Assets?
Your answer
Follow this Question
Related Questions
How to call and run a function from another script on a transform. 0 Answers
How to get info of object within certain range?(Javascript) 1 Answer
Getting a huge amount of errors regarding contained definitions in GameObject 1 Answer
Position of a GameObject 2 Answers
C# GameObjectList not Setting Parent 0 Answers