Controlling Elements from the Browser

Hi, new Unity user here, although I do know some Java Script and a lot of HTML.

I would like to control element in the Unity web player with buttons outside the player. For example calling the fadein script from a button outside the player. Can anyone give me some resources beyond the one page in the manual, or some exmples of Unity games utilizing Web Player and Browser communication, or some precanned scripts similar to the GUI Scripts on the wiki.

Thanks a lot
Luke

What would really be cool to see is a flash movie interacting with a unity web player.

It would answer the wish of using flash as a game UI. I need more time in the day to experiment :slight_smile:

The first example on this page might be useful (I haven’t looked at it yet):

http://unity3d.com/examples

basically, given the default html created by Unity, add this to the html:

<input type="button" value="DoIt!" onclick='GetUnity().SendMessage("MyObject","MyFunction",0)'" />

Then you just need a GameObject in Unity named “MyObject”, which implements “MyFunction”, and it will be called whenever you press the button in the html.

Jonas,
Thank you, the page in the documentation was pretty confusing, but you suggeston works like a charm.

Unity is dope.
Thanks a lot
Luke