- Home /
Can I Fake Cookies for Debugging in Web Builds?
Self Explanitory....I need to fake some cookies...since my player isn't running on the web, but in the debugger...
stringa
Answer by Statement · Dec 08, 2010 at 10:14 PM
Cookies? Are you referring to PlayerPrefs, or do you have another way of storing data? If you are using PlayerPrefs, they should work regardless of being on web or not.
In case you have a data access layer in your project, you can probably fake the cookies if there is a common interface, say ICookie.
class FakeCookie : ICookie
{
// getters return fake data from local file or elsewhere
}
as opposed to
class Cookie : ICookie
{
// getters return actual data
}
and then you can request the correct cookie such that
ICookie cookie = CookieFactory.CreateCookie();
health = cookie.Get("health");
which would do a check something like this
public static ICookie CreateCookie()
{
if (Application.isWebPlayer)
return new Cookie();
else
return new FakeCookie();
}
Your answer
Follow this Question
Related Questions
How to know if the running web player is the development or release one ? 1 Answer
Webplayer Log output missing stacktrace. 1 Answer
Security.PrefetchSocketPolicy does not work in debug session? 0 Answers
Why can't I build Web Player in Unity while I have no problems with building standalone versions? 2 Answers