Calling JavaScript functions in Vue from Unity scripts
alexis-regnaud opened this issue · 3 comments
alexis-regnaud commented
Hi,
I need to calling a function in my vue component from Unity scripts. What is the best way to do that?
Here, there is a exemple with React: https://npm.taobao.org/package/react-native-unity-webgl
If you know a solution to do the same thing in Vue ...
Thanks in advance.
akbarism commented
anyone please?
bondythegreat commented
- create 1 plain vanilla script's function in your
public/index.html
- save the data that is sent from unity in js global variable under window object
<script> function getUnityData(jsonObj) { window.jsonData = jsonObj; } </script>
- get the data using
computed
property in your vue component... or if you want to read it in interval, you can usesetInterval()
inside yourmounted
unityData() { return window.jsonData; }
well, i hope you got the point. good luck..