- Home /
Using variables and classes of C# in Javascript?
Hello,
I have a set of Javascript classes that each work on a number of static variables.
The problem is that some of these static variables are obtained by calling a function which my friend "conveniently" wrote in C# and will take me a while to convert back to Javascript.
My question is: I need to pass variables to a C# function and obtain the returned variables back into a Javascript file.
Is this possible?? I beg you...please help me out!!!
simply put: no, it's not possible. You'll need to convert it
that is, if you are passing the var from js to cs, or vice versa, it can be done, but the communication can only go ONE WAY, not javascript to c# then back again..
generally don't use static variables
if you need to go "both ways" you need todo the annoying trick of having a sort of "switchboard" function in the middle that both use.
Answer by whydoidoit · Nov 02, 2012 at 09:50 AM
You can do it one way by putting the c# in a folder under a Plugins folder (or Standard Assets). More details here
Your answer
Follow this Question
Related Questions
How to not rely on the Visual Interface 0 Answers
Distribute terrain in zones 3 Answers
iTween Visual Editor Event Call from C# to Javascript 1 Answer
Translating Javascript code into C# Code 2 Answers
Multiple Cars not working 1 Answer