How can I find the value of a variable in a different script?

I have two scripts. One is in javascript, the other in C#. The C# script has a variable called “a”. How do I find the value of that variable to use it in my javascript script?

Make the variable in your C# script public or use a property to return it.

The real question you want to ask is how to make your C# script visible in JavaScript.

With that you need to look at the unity script building order :

http://docs.unity3d.com/Documentation/ScriptReference/index.Script_compilation_28Advanced29.html

This may help. Unity3D: JavaScript -> C# or C# -> JavaScript access | 41 Post

The script with the variable you are trying to access should be in a folder called “Standard Assets” or “Plugins” so you ensure the right script gets compiled first.