Unity Ads and windows phone 8

I have a problem with unity ads.
If I add advertising(unity ads) to the application, then after that I can not build of background on windows 8.

When I build clear scene without Unity Ads I have:
I have error:
Error building Player: Exception: Error: type System.Security.Cryptography.MD5CryptoServiceProvider doesn’t exist in target framework. It is referenced from Assembly-CSharp-firstpass.dll at System.Void UnityEngine.Advertisements.Event.Event::init().
Error: type System.Security.Cryptography.MD5CryptoServiceProvider doesn’t exist in target framework. It is referenced from Assembly-CSharp-firstpass.dll at System.Void UnityEngine.Advertisements.Event.Event::init().
Error: method System.Void System.Security.Cryptography.MD5CryptoServiceProvider::.ctor() doesn’t exist in target framework. It is referenced from Assembly-CSharp-firstpass.dll at System.Void UnityEngine.Advertisements.Event.Event::init().
Error: method System.Void System.Collections.Hashtable::.ctor(System.Collections.IDictionary) doesn’t exist in target framework. It is referenced from Assembly-CSharp-firstpass.dll at System.Boolean UnityEngine.Advertisements.HTTPLayer.HTTPRequest/c__Iterator1::MoveNext().
Error: method System.Void System.IO.File::WriteAllBytes(System.String,System.Byte[ ]) doesn’t exist in target framework. It is referenced from Assembly-CSharp-firstpass.dll at System.Void UnityEngine.Advertisements.PictureAdsRequest::HTTPFileCallback(UnityEngine.Advertisements.HTTPLayer.HTTPResponse).

In Events I change:
System.Security.Cryptography.MD5CryptoServiceProvider md5 = new System.Security.Cryptography.MD5CryptoServiceProvider();
byte[ ] destBytes = md5.ComputeHash(srcBytes);

string finalHash = System.BitConverter.ToString(destBytes).Replace(“-”, string.Empty);

reqIdBase += finalHash + “-”;

To:
#if !UNITY_WP8
System.Security.Cryptography.MD5CryptoServiceProvider md5 = new System.Security.Cryptography.MD5CryptoServiceProvider();
byte[ ] destBytes = md5.ComputeHash(srcBytes);

string finalHash = System.BitConverter.ToString(destBytes).Replace(“-”, string.Empty);

reqIdBase += finalHash + “-”;
#endif

I have new error with not supported Hashtable:

Error building Player: Exception: Error: method System.Void System.Collections.Hashtable::.ctor(System.Collections.IDictionary) doesn’t exist in target framework. It is referenced from Assembly-CSharp-firstpass.dll at System.Boolean UnityEngine.Advertisements.HTTPLayer.HTTPRequest/c__Iterator1::MoveNext().
Error: method System.Void System.IO.File::WriteAllBytes(System.String,System.Byte[ ]) doesn’t exist in target framework. It is referenced from Assembly-CSharp-firstpass.dll at System.Void UnityEngine.Advertisements.PictureAdsRequest::HTTPFileCallback(UnityEngine.Advertisements.HTTPLayer.HTTPResponse).

And to build the project, you must first delete unity ads

I thought Unity Ads only supports iOS and Android?

The scripts contained within Unity Ads are currently missing the compiler conditional statements necessary to support building for unsupported platforms. We have an update in test right now that fixes this.

For the time being, you can wrap the Unity Ads code with compiler conditional statements like so.

1 Like

Im confused to what you mean? So if i Build to unsupported platform technically ads still may work with the next update?

I did so.
I change all Hashtables, One Md5 and one System.IO.File.WriteAllBytes.
I can now do build game for windows phone.

This means that now you can not do the build. Even if you are not using unity ads. When assembling, you will get compilation errors.

Unity Ads was written for iOS and Android. For scripts in the Unity Ads asset package, there should be compiler conditional statements that wrap the code specific to those platforms, so that when you switch to an unsupported platform like Windows Phone 8, the code won’t get compiled and won’t generate any errors.

// For each script in the Unity Ads asset package
// Insert the following line as the first line of the script:
#if UNITY_IOS || UNITY_ANDROID

//*** KEEP CONTENTS OF UNITY ADS SCRIPT HERE ***

// Then add the following line as the last line in the script:
#endif
2 Likes

When will there be an update with those conditional checks ? Currently every time I switch the build to webplayer, I can not build my game. It’s not hard to do, but it’s better if you guys do it so everyone don’t need to do it again and again …

When is this fix due officially, I hope for new release very soon - not sure how you guys work, weekly builds or ever so often a few issues are resolved?

Our development team operates on 3 week sprint cycles, but recently most of that effort has been directed towards server-side improvements and optimizations. Which have been necessary since our user base has grown so rapidly in the last year.

There are some big changes and improvements coming down the line for the Unity Ads SDK, but that’s also somewhat slowed progress on the release. Currently, priorities have shifted focused to preparing for GDC. But still, my hopes are that we’ll have an update available before then.

2 Likes

Hi,
Nikkolai, there is a plan to include Unity Ads on windows phone?

Not in the near future. We’re limited to just iOS and Android for now.

No Windows Phone? Well damn. Now what am I gonna do for my WP users.

Fun fact, I get more downloads on WP than Android. So, I hope u guys add this soon.

2 Likes

Oh come on, I’m tired of unity features not being supported on Windows Phone. I thought Microsoft was working with Unity to woo developers. Facebook login, Unity Ads, Cloud build - none of these are supported so I’m going to have to hold off on publishing my game for Windows Phone

Is this because of Windows 10? Are all features being held off until then?

1 Like

+1 for supporting Windows Phone!

GooglePlay does seem to be the worse store front for peons, thank you haggers, trying to SEO game the system, lol. So Windows Phone and Windows Store support would be nice. Maybe it’s forbidden by MS?

Probably isn’t forbidden, more likely the typical marketshare issue so Unity won’t bother adding support. Hopefully with windows 10.

+1 for supporting Windows Phone!

I also hope that it will be supported in the (near) future…

1 Like

Go unity ads on windows phone!!