Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
4
Question by dansav · Mar 31, 2016 at 11:13 PM · webglbrowser communication

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 **

Comment
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image moosefetcher · Sep 20, 2016 at 09:06 AM 0
Share

I'm having exactly the same problem. If I figure it out, I'll let you know...

avatar image Cyrille_O · Aug 23, 2017 at 02:11 PM 0
Share

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

2 Replies

· Add your reply
  • Sort: 
avatar image
2
Best Answer

Answer by moosefetcher · Sep 20, 2016 at 02:11 PM

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: https://docs.unity3d.com/Manual/webgl-templates.html )
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...

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image dansav · Sep 20, 2016 at 07:16 PM 0
Share

Yeah it's still useful and I still have that problem, plus you had a few other good ideas. Thanks.

avatar image LilGames · Jul 17, 2018 at 01:55 AM 0
Share

Your method is deprecated and will no longer work in a future version of Unity.

Any solutions using the current recommended method? The problem is exactly as the OP has said: EntryPointNotFoundException: Hello

avatar image
3

Answer by LilGames · Jul 17, 2018 at 02:05 AM

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.

Comment
Add comment · Show 5 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Bunny83 · Jul 17, 2018 at 05:44 AM 2
Share

Actually it's more common to just replace the method definition in the sense of:

 #if UNITY_WEBGL
     [DllImport("__Internal")] private static extern void Hello();
 #else
     private static void Hello()
     {
         // maybe some replacement code for other build targets or just an empty method
     }
 #endif

avatar image LilGames Bunny83 · Jul 17, 2018 at 12:59 PM 0
Share

Yes, even better!

avatar image Qwerku · Jan 08, 2019 at 06:39 PM 0
Share

This does not actually execute my javascript when I run WebGL in a browser, just throws a strange error (and yes, I enabled WebGL only on the jslib inside the editor). The accepted answer above might be deprecated, but at least it works.

avatar image LilGames Qwerku · Jan 08, 2019 at 07:32 PM 0
Share

Can you elaborate on what "a strange error" is?

avatar image Umresh · Jan 18, 2019 at 10:47 AM 0
Share

hi, I'm trying to call browser js function from webgl jslib and it doesn't work. I tried converting the whole browser js to jslib then calling the function but still doesn't work. There are some html elements manipulation and those doesn't work. Is there a way to call the browser js function from webgl jslib. I can use Application.ExternCall() but its deprecated. i'm using unity 2018.3.0f2

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

49 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How to send multiple values from browser to unity webgl game? 1 Answer

Interact across browser javascipt and unity webgl 2 Answers

Check if Javascript function exists on webpage before calling ExternalCall 1 Answer

WebGL build callback on tab close or browser quit. 1 Answer

Open in link in lightbox/colorbox from webgl 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges