EntryPointNotFoundException when trying webgl browser communication jslib example

I’m following the webgl browser communication jslib tutorial at

http://docs.unity3d.com/Manual/webgl-interactingwithbrowserscripting.html

and get the following error.

EntryPointNotFoundException: Hello
NewBehaviourScript.Start () (at Assets/NewBehaviourScript.cs:25)

The project compiles and works even with the error. How do I get rid of the error in the editor?

Also in the example
[DllImport(“**Internal”)]
private static extern void Hello();

should be __ instead of **

I had a similar problem, and I’ve managed to completely dodge the issue!

I’d recommend using the first option from the page you link to.

Put your javascript file(s) in a folder, relative to the final build index.html.

Use a custom WebGL html template. This involves:

Creating a folder called ‘WebGLTemplates’ in your ‘Assets’ folder.
Create a folder with the name of your template in ‘Assets/WebGLTemplates’.
Put your index.html file in that folder (an example can be found on this page: Unity - Manual: WebGL templates )
In Unity Editor select Edit > Project Settings > Player and select your new html template from the Web GL templates available

Your new index.html template should, of course, load in your external .js file(s), eg:

<script src="js/YourExternalFile.js"></script>

You can then call those external .js functions from your C# with, for eg:

Application.ExternalCall("functionName", "placeHolderParameter");

And, even cooler, you can call functions in your Unity code (by GameObject name) from your external .js,. with, for eg:

SendMessage ('GameObjectName', 'functionName', 'placeholderParameter');

And the GameObjectName can even be the name of a string variable.

Hopefully this is useful - I realise it’s been 6 months since you asked…

Here is the real solution to the original problem:

The error is because the js lib can only work in WebGL. You must wrap your code with the following so that it does not execute in the editor :

#if UNITY_WEBGL
Hello();
#endif

source: https://forum.unity.com/threads/webgl-return-value-from-javascript-function.486095/#post-3193717

.

Also note, in the editor, you can click on the jslib file and view some options in the Inspector. Make sure “WebGL” is checked so that it will work in WebGL.

hi,
I met the same problem as you do…did you find a solution ?