PlayerPrefsx

From Unify Community Wiki
(Difference between revisions)
Jump to: navigation, search
(JavaScript - PlayerPrefsx.js)
Line 1: Line 1:
 
[[Category: WWW]][[Category: JavaScript]][[Category: WebPlayer]]Author: StarManta; built on [[CookieCutter]] by [[User:KeliHlodversson|KeliHlodversson]]
 
[[Category: WWW]][[Category: JavaScript]][[Category: WebPlayer]]Author: StarManta; built on [[CookieCutter]] by [[User:KeliHlodversson|KeliHlodversson]]
  
CURRENTLY BROKEN, will upload a new version when I figure out what's going wrong.
+
CURRENTLY FIXED, but uses some as yet unreleased features. will release when these features are public.
 +
 
 
==Description==
 
==Description==
 
CookieCutter is a utility script for accessing the browser cookies from the web player. PlayerPrefsx takes that base, and adds functions so that, to make your game web-game-save compatible, you can simply find and replace PlayerPrefs with PlayerPrefsx. PlayerPrefsx will automatically determine whether to use CookieCutter code or PlayerPrefs code so your game can always save.
 
CookieCutter is a utility script for accessing the browser cookies from the web player. PlayerPrefsx takes that base, and adds functions so that, to make your game web-game-save compatible, you can simply find and replace PlayerPrefs with PlayerPrefsx. PlayerPrefsx will automatically determine whether to use CookieCutter code or PlayerPrefs code so your game can always save.

Revision as of 04:33, 9 October 2007

Author: StarManta; built on CookieCutter by KeliHlodversson

CURRENTLY FIXED, but uses some as yet unreleased features. will release when these features are public.

Contents

Description

CookieCutter is a utility script for accessing the browser cookies from the web player. PlayerPrefsx takes that base, and adds functions so that, to make your game web-game-save compatible, you can simply find and replace PlayerPrefs with PlayerPrefsx. PlayerPrefsx will automatically determine whether to use CookieCutter code or PlayerPrefs code so your game can always save.

Usage

Unlike CookieCutter, PlayerPrefsx creates its own GameObject when it is needed. All you have to do is place the script in your Plugins folder. Replace (Find/Replace) all references to "PlayerPrefs" in your files (NOT in PlayerPrefsx.js) to PlayerPrefsx. That's all!

Notes

  • Safari requires the embedding html to be served from an http: url. When testing on a local file url, no cookies will be saved or returned. Either enable personal web sharing and open the player through http://localhost/... or use a browser that supports cookies on file:// urls (eg. Firefox)
  • Watch the size of the cookies. All cookies defined using this module will be sent to the web server serving the web player on every web request. This increases the amount of data sent to the server, but might also compromise privacy if the cookies contain sensitive data. Especially if you are hosting the player on a domain name shared by others. You can limit the scope of the cookies created by this module by setting the path variable to limit the cookie to a subdirectory on the web server. (Ie. if the web player is located at http://myhost.com/myProjects/coolGame/webPlayer.html, set path to /myProjects/coolGame to ensure the cookies are not available to urls outside that directory on the web server.)

JavaScript - PlayerPrefsx.js

BROKEN

Personal tools
Namespaces

Variants
Actions
Navigation
Extras
Toolbox