So folks,
I know there are a ton of those answers on this and I tried so far to follow these, but for some reason I the c# variable can not be called properly from the JavaScript.
-
I have moved the c# joystick script (thanks to GibTreaty) into the Plugins folder at the root of the whole assets folder.
-
The javaScript that is handling the variable from the Joystick.cs to move the character is placed under Assets/Resources/Scripts. It would be a pain to rewrite all this to c# despite that I always code in js. Should change that. ‘_’
With this from what I have read here the scripts are executed in the correct compilation phase.
I changed the Vector2 to public, so the js can have access to that.
Here the associated code from the JS:
function Start(){
axis = GameObject.Find("JoystickMove").GetComponent.<Joystick>()._axis;
}
function Update(){
Debug.Log(axis.x);
}
It always prints 0 for the x-value of the Vector2, even when I move the joystick around.
Any suggestions?