GetXMLHack

I've been having trouble getting the Web Player to download XML properly using built in WWW calls so I've come up with this work around. ( Please excuse the sparse nature of the page, feel free to tidy it up more if you like to do such things. :) )

You really should use WWW where possible but it's been giving me back corrupt data and suffering from what appears to be a buffer overflow bug somewhere between the browser and the unity plugin. This page offers a work-around.

There is no facility for pushing data to the server demonstrated here.

Attach this code to the Unity Object you want to use as a button, I've been using a GUITexture. I have created an object called BrowserMarshal that I use to deal with any incoming messages from my browser side scripts. You can pass-out any object name in the function call above, the script on the other side will respect it.

Use this function in the browser to handle your call for XML data: (This script depends on Googles Mapping API objects, replace GXmlHttp below with XmlHttpRequest(?)...)

This is the script that resides in BrowserMarshal:

Rough XML example. All branch tag names are unique.      

Example HTML example. Note the value of the id parameter.     The browser does not have Unity Web Player installed. Get Unity Web Player