x


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

more ▼

asked Dec 08 '10 at 09:08 PM

stringa gravatar image

stringa
257 37 39 42

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

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();
}
more ▼

answered Dec 08 '10 at 10:14 PM

Statement gravatar image

Statement ♦♦
20.1k 35 70 175

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x810
x239
x11

asked: Dec 08 '10 at 09:08 PM

Seen: 800 times

Last Updated: Dec 08 '10 at 09:08 PM