votetake/vue-unity-webgl

calling vue js function from unity

akbarism opened this issue · 3 comments

can unity call the function in vue js?
so I have a case where when the game is finished, vue knows that and runs the function,

HELP DID YOU FIGURE IT OUT?

Documentation on Unity Portal WebGL: Interacting with browser scripting

TL;DR: anywhere in your application, you can declare functions that Unity will then call. Example declare on created or mounted methods and when call it from Unity

created() {
    window.gameFinished = function () {
        console.info('window.gameFinished');
    }
}

Or see @bondythegreat comment in a similar issue