Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calling JavaScript functions in Vue from Unity scripts #7

Closed
alexis-regnaud opened this issue Aug 1, 2018 · 3 comments
Closed

Calling JavaScript functions in Vue from Unity scripts #7

alexis-regnaud opened this issue Aug 1, 2018 · 3 comments

Comments

@alexis-regnaud
Copy link

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
Copy link

akbarism commented Feb 2, 2021

anyone please?

@bondythegreat
Copy link

  1. create 1 plain vanilla script's function in your public/index.html
  2. save the data that is sent from unity in js global variable under window object
    <script> function getUnityData(jsonObj) { window.jsonData = jsonObj; } </script>
  3. get the data using computed property in your vue component... or if you want to read it in interval, you can use setInterval() inside your mounted

unityData() { return window.jsonData; }

well, i hope you got the point. good luck..

@votetake
Copy link
Owner

I also wrote an example in #26

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants