- Home /
why is my javascript to webgl communication so slow for a large string
I'm trying to send a 1000 character data string back and forth from javascript to webgl. In my tests so far it takes about 500 ms to send 30 of them back and forth.
Why is communicating between js and unity so slow?
Is there any way to speed this up?
Webpage javascript:
var bigstring= 1000 character string;
function Start(){ JSMessageFromUnity(bigstring); }
var counter=0;
function JSMessageFromUnity(s){
counter+=1;
if(counter>30)return;
SendMessage("main","UnityMessageFromJS",s);
}
UnityScript:
function UnityMessageFromJS(s:String){
Application.ExternalEval("JSMessageFromUnity('"+s+"')");
}
Answer by sixpentdev · Dec 11, 2019 at 03:11 AM
because SendMessage is slow, try using this https://github.com/atteneder/UnityJavascriptInteraction
Your answer
Follow this Question
Related Questions
Protecting WebGL Unity application from SendMessage exploitation 0 Answers
How to send multiple values from browser to unity webgl game? 1 Answer
How can I send russian symbols from JS to Unity WebGL 0 Answers
how to use sendmessage to call a unity function from html 1 Answer
Connection slower with higher update rate using LLAPI. webgl 0 Answers