- Home /
variable js to c#
I have a variable in js I want to call in c #, how do I through GetComponent ()? I use to be able to use Ngui
Comment
send the js script to StandardAssets.
class $$anonymous$$yclass : $$anonymous$$onoBehaviour {
dynamic Javascriptvariable;
public void Start() {
Javascriptvariable = ($$anonymous$$yJAvascriptClass) gameObject.GetComponent("$$anonymous$$yJAvascriptClass").$$anonymous$$yvar
}
}
Answer by tanoshimi · Nov 02, 2013 at 01:48 PM
Put the Js script in the standard assets folder so that is compiled before, and therefore available to, the C# script.
http://docs.unity3d.com/Documentation/Manual/ScriptCompileOrderFolders.html
Your answer
Follow this Question
Related Questions
Use of unassigned local variable `selection' Destroying instance 1 Answer
Converting this JS code to C# 1 Answer
storing the value in a temporary variable problem 1 Answer
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers