couldn’t find nowhere how to do it.
I colaborate with a programmer who writes the core program logic in C#. I do the visual stuff and write in JavaScript. So i made a ‘public’ .js script with some static variables in it. They get manipulated by the GameGUI.
Now from the C#-script side,
what is the correct C#-syntax to read this static variables into some local vars?
And after those variables have gotten some calculation, how to write them back into the static variables of my ‘public’ .js?
You can’t do that. It drove me nuts for a while, I ended up using functions inside of the C# that set variables and called them from the js when I needed them. Not much fun lol or easy to build off of.
As dreamora mentioned, if you need to use CS and JS, a messaging system on top of SendMessage can be a good way to interoperate.
You might have a look at the article that the guys at Blurst Technology wrote on this. I’ve implemented this in CS (the article covers it in Javascript) and use it to pass messages between script types.
I’m having a similar question. I need a js script to send a message to a c# script (setting a variable, btw) when it has completed an action. I tried with SendMessage, but it tells me it doesn’t find a receiver method, so I think I didn’t really catch the point…