`System.IO.File' does not contain a definition for `WriteAllBytes'

This one keeps biting me.
I need to save objects from a script that works during runtime.
I use this alot to record custom data, including splat maps and lists of data to be reread at runtime for level generation etc.


System.IO.File.WriteAllBytes(pAddress, vImg);


I get this error on web player platform, which prevents compiling.


System.IO.File' does not contain a definition for WriteAllBytes’


It doesn’t need to be able to save from the web payer (I’d do that with php if I ever needed to), but commenting and uncommenting this out everywhere and switching platforms for an edit is a pain in the neck.
I’ve tried wrapping
#if UNITY_EDITOR
style compile directives round it, but to no effect.
Does ayone know an alternative method, which prevents this problem? Or how to tell the Unity Editor
“I know I can’t save local files, just don’t give me the error”
or
“Just don’t read this line when you know you’re publishing to Web”.

Check out these docs:

One of the platform dependent defines you can use is UNITY_WEBPLAYER, so you should be able to do something like:

#if !UNITY_WEBPLAYER
//stuff that isn't supported in the web player
#endif