I want to call a unity webgl function from a vue website, in order to do this I have the following javascript/vue code:
var data = Unity3dViewer.data();
data.gameInstance.SendMessage("BrowserCommunication", "GetAllLightsJson");
Meanwhile the script on the unity side of things looks like this:
public void GetAllLightsJson()
var lights = GameObject.FindObjectsOfType<LightController>();
string json = "[";
foreach (var light in lights) {
Vector3 loc = light.transform.position;
json = json + "{ 'location' : {'x': " + loc.x * 0.3048 + ",'z': " + loc.y * 0.3048 + ",'y': " + loc.z * 0.3048 + "}," + "'normal' : {'x':0,'y':0,'z':-1} },";
}
json = json.Remove(json.Length - 1);
json = json + "]";
}
Now for some reasons this causes the error:
An error occurred running the Unity content on this page. See your browser JavaScript console for more info. The error was:
TypeError: self.performance is undefined
where the console shows the following details:
exception thrown: TypeError: self.performance is undefined,_emscripten_get_now@blob:http://localhost:50922/62fd591f-d987-4bcf-aff1-9ae5cb3530d4:2:350525
@blob:http://localhost:50922/62fd591f-d987-4bcf-aff1-9ae5cb3530d4 line 2 > WebAssembly.instantiate:wasm-function[7069]:0x382dd2
@blob:http://localhost:50922/62fd591f-d987-4bcf-aff1-9ae5cb3530d4 line 2 > WebAssembly.instantiate:wasm-function[7068]:0x382b8b
@blob:http://localhost:50922/62fd591f-d987-4bcf-aff1-9ae5cb3530d4 line 2 > WebAssembly.instantiate:wasm-function[9262]:0x471c95
@blob:http://localhost:50922/62fd591f-d987-4bcf-aff1-9ae5cb3530d4 line 2 > WebAssembly.instantiate:wasm-function[8647]:0x429614
@blob:http://localhost:50922/62fd591f-d987-4bcf-aff1-9ae5cb3530d4 line 2 > WebAssembly.instantiate:wasm-function[8647]:0x42962b
@blob:http://localhost:50922/62fd591f-d987-4bcf-aff1-9ae5cb3530d4 line 2 > WebAssembly.instantiate:wasm-function[8642]:0x428840
@blob:http://localhost:50922/62fd591f-d987-4bcf-aff1-9ae5cb3530d4 line 2 > WebAssembly.instantiate:wasm-function[8636]:0x42707e
@blob:http://localhost:50922/62fd591f-d987-4bcf-aff1-9ae5cb3530d4 line 2 > WebAssembly.instantiate:wasm-function[99461]:0x29daf84
UnityLoader.db99c972aa57aeb012a876572a3f4cf4/Module.dynCall_v@blob:http://localhost:50922/62fd591f-d987-4bcf-aff1-9ae5cb3530d4:2:519017
browserIterationFunc@blob:http://localhost:50922/62fd591f-d987-4bcf-aff1-9ae5cb3530d4:2:131846
runIter@blob:http://localhost:50922/62fd591f-d987-4bcf-aff1-9ae5cb3530d4:2:134938
Browser_mainLoop_runner@blob:http://localhost:50922/62fd591f-d987-4bcf-aff1-9ae5cb3530d4:2:133383
UnityLoader.js:4:10740
printErr
http://localhost:50922/dist/Viewer/Build/UnityLoader.js:4:10740
runIter
blob:http://localhost:50922/62fd591f-d987-4bcf-aff1-9ae5cb3530d4:2:135029
Browser_mainLoop_runner
blob:http://localhost:50922/62fd591f-d987-4bcf-aff1-9ae5cb3530d4:2:133383
And crashes unity in it's entirety (the webplayer becomes unresponsive). Anybody know what this errors means and how to fix it?