Domanda

I hit the following problem when I try to buid a windowsPhone 8 and webPlayer game from Unity: "error CS0117: System.IO.File' does not contain a definition forWriteAllLines' " but the System.io.File work fine when I buid the game for android platform, anyone tell me why?

È stato utile?

Soluzione

This is not available to Web Player for security reasons (Unity don't want people making websites that can access the file system) and it's not available to Windows Store Apps and Windows Phone 8 simply because this API doesn't exist in these platforms. It was replaced by the Windows.Storage API, and that's what you have to use for these platforms (WSA & WP8).

But... it's not so simple: Windows.Storage is not available for Android, etc, so you have to use compilation directives like #if UNITY_WP8. You have UNITY_WINRT, UNITY_WP8 and UNITY_METRO.

I recommend you take a look at these porting guides, they'll give you a good idea on working in Unity for Windows Phone and Windows Store Apps.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top