Can iPhone-specific scripts work on non-iPhone Unity?

The project I’m working on has me (programmer) working in Unity iPhone while another (artist) is working on the PC in Unity Pro.

Is there any way to do conditional compilation or anything in C# that could somehow wrap script calls to things like getting iPhone acceleration events so that the scripts will work as-is on the PC version? Or somehow defining a dummy iPhoneInput class that the PC can use so that it compiles but doesn’t do anything?

It would be nice if there were some fallback solutions on the PC so that the artist can still see the game running the scripts even if it isn’t on a device or if he doesn’t have a Mac.

Probably the best solution I have seen for this is within the GUIManager http://forum.unity3d.com//viewtopic.php?t=23557&highlight=guimanager which includes a file called iTouch.cs which duplicates a lot of the iPhone specific classes and works well for porting over your code.

Otherwise if you just wanted to use preprocessor directives to separate out specific blocks of code

#if UNITY_IPHONE 
// iphone code
#else
// not iphone code
#endif

you could do it with some fancy inheritance or interface based design, if you can abstract the functions to something like -

void DoHardwareSetup()

and have all the iPhone functions in a class inheriting or implementing a Hardware class or interface.

Then, at worst, you could just replace 1 script and be done.

It would keep you code cleaner than a bunch of conditionals too, although, if you wanted a different control mechanism, UI, etc, this wouldn’t quite cover it.