Im looking for a way to store data on a users computer for a site - even if its just for one runtime session. Much like a cookie or a php session.
I was wondering if PlayerPref’s can be used by a web player.
If so Are there any issues with PlayerPref’s if LoadUnityWeb is used?
Is it possible to transfer data from one gameworld to the next?
I have tried using php sessions, which I managed to get working but required use of javascripts XML-RPC(ajax) and communication between unity and javascript. And whilst it worked for me its not guaranteed to work on all browsers and machines.
I’m not quite sure how PHP sessions are implemented, but I suspect it’s via an unholy combination of cookies and some dodgy attempt to id clients based on IP address, user agent, etc. (if the browser doesn’t support cookies).
AJAX is going to work on all the browsers you care about. Anyone using a browser that doesn’t support AJAX is probably (a) not running Unity, and (b) probably experiencing so much stuff not working, that your game not working is hardly going to come as a shock.
AJAX is fully supported by KHTML/Webkit-based browsers (such as Safari), IE (of course), Gecko-based browsers (such as FireFox, Mozilla, and Camino), and Opera.
Pretty much the only browsers that won’t support it are either running on machines that won’t run Unity OR have had JavaScript support explicitly disabled. Again, anyone who does this is hardly going to run some unverified plugin from a tiny company.
For the 0.01% of potential customers you may lose, here’s a workaround:
<noscript>
<h1>You might consider enabling JavaScript if you want to play games online, bonehead.</h1>
</noscript>