I was trying to use the ratelimiter in my project in Unity, but couldn't get it working.
When I add the rate-limiter.js script, from the airconsole-controls github to my Unity project. I get errors concerning missing semicolons, which can be seen in this picture:
When I add these semicolons, I get a lot of new errors, seen in this picture:
I don't really know what the problem is. Am I required to import the rate-limiter.js script? Nothing happens when I try to use the ratelimiter without it. It doesn't send the data to my OnMessage, in my other script, where I print out all data, which works fine without ratelimiter.
My instantiation of airconsole in controller.html looks like this:
var airconsole;
var rateLimiter = new RateLimiter(airconsole);
function init() {
airconsole = new AirConsole({ "orientation": "portrait", "device_motion": 100});
}
function move(amount) {
rateLimiter.message(AirConsole.SCREEN, {move: amount})
}
The part of the other script where I print out the data looks like this:
void OnMessage(int device_id, JToken data)
{
print(data);
}
I have also tried instantiating ratelimiter in function init and I also tried it without the function init like this.
var airconsole = new AirConsole({ "orientation": "portrait", "device_motion": 100});
var rateLimiter = new RateLimiter(airconsole);
Do anyone know what I am doing wrong or how to correctly use ratelimiter?
The AirConsole RateLimiter does not work on the screen inside the AirConsole Unity Plugin. It is intended for HTML5 controllers & HTML5 Screens.
Just to be clear: The RateLimiter works fine in html5 controllers that talk to unity games, but not inside unity games.