Inside of the Unity web player content you need to have a script attached to the GameObject named MyObject, and that script needs to implement a function named MyFunction: function MyFunction(param : String) Here is an example JavaScript function that would execute the SendMessage() function on the Unity web player in turn SendMessage() will then call the function MyFunction() on the game object named MyObject, passing a piece of string data as an argument: You can use the GetUnity() function in the default html generated by Unity to obtain a reference to the object. In order to call the Unity Web Player’s SendMessage() function you must first get a reference to the Unity web player object. When called from a web page you pass an object name, a function name and a single argument, and SendMessage() will call the given function in the given game object. This function is very similar to the GameObject.SendMessage function in the Unity scripting API. The Unity Web Player object has a function, SendMessage(), that can be called from a web page in order to call functions within Unity web player content. Calling Unity web player content functions from the web page The Unity web player content calls functions in the web page.Įach of these communication directions is described in more detail below.The web page calls functions inside the Unity web player content.Basically there are two communication directions: ![]() The HTML page that contains Unity Web Player content can communicate with that content and vice versa.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |