Search code examples
webunity-game-enginecommunicationunityscript

Unity game and web browser communication


According to docs, we can make a call to JS function inside a page, that host a unity game:

Application.ExternalCall( "SayHello", "The game says hello!" );

Where 'SayHello' is the function name in JS. But if i want to make a call to function that a method of some JS object?

Will it work?

Application.ExternalCall( "JsObject.SayHello", "The game says hello!" );

Thanks!


Solution

  • Maybe something like this

    var f = function(){ JsObject.SayHello(); };
    Application.ExternalCall( "f", "The game says hello!" );