I have followed this to the letter, not even getting the Application.ExternalCall to the browser.
I have found that the result of var u = new UnityObject2(); as specified in the link is that u is NULL. There is a note that that may happen if game is not fully loaded.
So how to delay my call till the game is loaded.
How can I tell that the player and assets are ready to go?
Where exactly are you calling this new UnityObject2() code?
Thank you again for responding and taking an interest. Sorry for the delay, holiday time here. I ran the test in Chrome and FireFox. In both cases I get "object, Object".
When you build your project with Web Player target, two files are in the output folder: xxxxx.html and xxxxx.unity3d. Please take a look at the content of html one - there are parts that must be included, in order for the whole stuff to work. Script used to dynamically include UnityObject2.js for example:
Thank you. I have done exactly that. In fact I have also tried .... //u.getObjectById("unityPlayer").SendMessage("MyObject", "MyFunction", "Hello from web page"); and //document.getElementById("unityPlayer").SendMessage("MyObject", "MyFunction", "Hello from a web page!"); I also have Application.ExternalCall ("MyFunction2", "Hello from Unity!"); in Unity at Start on an object calling the browser and getting nothing. Very frustrating.
After all of this something about your last suggestion/communication triggered the old brain cells.
I have been trying to do this through the Flash build.
I instead, this morning, tried a build of the Web Player and it all works as advertised. I wish I could do it through the Flash build though.
Thank you all for sticking with me through this discovery process.
Where exactly are you calling this
– ArkaneXnew UnityObject2()code?Thank you again for responding and taking an interest. Sorry for the delay, holiday time here. I ran the test in Chrome and FireFox. In both cases I get "object, Object".
– diggerjohn