- Home /
Sending the C# function parameter to JS function.
I'm trying to implement kinect to one of my games. Already got the function which listens to kinect gestures and recognises them well. Function is written in C#. It basically set boolean function to true after the gesture, than other function is setting it back to false just to reset the flag.
if (gesture == KinectGestures.Gestures.SwipeLeft)
{
swipeLeft = true;
}
public bool IsSwipeLeft()
{
if (swipeLeft)
{
swipeLeft = false;
return true;
}
return false;
}
I've been trying to send that boolean variable to JS function that works as character controller. I did it like that
public var gesturesListener: GestureListener;
//in start()
gesturesListener=this.GetComponent(GestureListener);
//in controlling function
if(gesturesListener.IsSwipeLeft())
{
GestureInfo.text = "left";
return SwipeDirection.Left;
}
I also tried checking the if swipeLeft var is true but with no effect. I set up debuging to check if it's working or not.
Does enyone have an idea, how to fix it? Thanks.
Answer by JoshDangIt · May 22, 2016 at 03:16 PM
You can only reference classes and functions from scripts in other languages if the file containing the class/function you are referencing is put in a 'Plugins' or 'Standard Assets' folder.
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Lower player's health from separate script. 2 Answers
Having a problem translating part of a script which uses C# delegates into JS 0 Answers
Can someone translate C# to Javascript? 2 Answers
Convert c# to Js? 1 Answer