Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

SOLVED: Call the JavaScript function already existing in HTML page from the WebGL?

Discussion in 'WebGL' started by ivank, Dec 8, 2019.

  1. ivank

    ivank

    Joined:
    Nov 16, 2013
    Posts:
    46
    Hello, sorry for so simple question, but to my surprise I really was not able to find a direct answer:

    How can I call the JavaScript function, already existing in the standard <script> tag within the html page, from the embedded Unity WebGL scene?

    In fact I am looking for direct replacement of the simple "Application.ExternalCall" deprecated
    without clear definition of its successor in the manual - it mentions just the javascript functions put in a jslib file stored in Unity project's "Assets" folder.

    Sorry again if I have overlooked anything apparent and clear :)
     
  2. ivank

    ivank

    Joined:
    Nov 16, 2013
    Posts:
    46
    Silly me - of course the Javascript function in html page can be called directly by the Javascript code in the file with .jslib extension under a “Plugins” subfolder in the Assets folder of the Unity project, as described in the Unity Manual.
     
    De-Panther likes this.
unityunity