5.2 brings even easier integration for some Unity services which is great. For Unity Ads I’m struggling to see how to correctly migrate though. Steps so far:
It appears 5.2 no longer requires the SDK/package download from the Unity store, so I’ve removed that from my project (using the package uninstaller asset from the Unity Store).
Once that was done the ShowOptions() creation in my code needed to be tweaked as it looks like there are differences in the Unity integrated version (specifically ‘pause’ appears to have been removed).
Toggled on the Ads service in the new 5.2 services window. This appears to auto-create a new project, game IDs and placement identifiers that are only visible on the new Unity Ads dashboard (dashboard.unityads.unity3d.com/), completely ignoring what’s currently in production.
So, issues/questions are:
Why are there now two dashboards? What’s the long-term plan for these?
Is there any way to get the in-production ads/gameIDs to show up in the new dashboard and ads services panel in the editor? Likewise for all the historical stats/data.
Assuming this isn’t possible will calling Advertisment.Initialize() with the old gameIDs continue to work? The hint for the method seems to imply it’s mutually exclusive with having the ads service toggled on in the services panel. Should I just give up on the current/old setup?
I can’t see a way on the new dashboard to edit/delete the placements or see which is now default - which placement is getting checked by IsReady() ?
A few API changes were made to the Unity Ads asset package when version 1.2.0 released:
Advertisement.isReady is now Advertisement.IsReady
DebugLevel.ERROR is now DebugLevel.Error, WARNING is Warning, etc.
Advertisement.allowPrecache was removed
ShowOptions.pause was removed (video ads will always pause the game)
gamerSid was moved from ShowOptionsExtended to ShowOptions
ShowOptionsExtended was removed
The new Services window does give you the option to link to an existing Unity Project ID, or create a new one. If the project you select hasn’t been initialized with Unity Ads before, two new game IDs will be created (one for iOS and one for Android) when you enable Unity Ads.
You can reassign existing game IDs under Advanced in the Settings tab of Ads in the Services window.
Enabling the toggle switch for Ads in the Services window enable API access for Unity Ads. Disabling it will disable Ads in the Unity Engine, but will allow you to import and continue to use the Unity Ads Asset package without encountering an API conflict.
EDIT: Disabling either iOS or Android platforms under Ads in the Services window will strip the Unity Ads API from the build when building for the disabled platform. To manually initialize Unity Ads, you’ll need an editor script that disables the initializeOnStartup property of AdvertisementSettings. See the following post for details.
Enabling the Test Mode option will show test ads when showing ads on device (a placeholder will always appear instead when showing ads in Editor). Disabling the Test Mode will show live production ads on device. You can override the test mode option from the old Unity Ads Admin by updating the Ad Test Mode settings under the Monetization Settings tab of your game profile.
Please keep in mind you should always leave test mode enabled while developing and testing your app. You are not permitted by our Terms of Service agreement to click on live production ads in your own game.
Unity Ads is migrating to a new Unity Ads Admin (http://dashboard.unityads.unity3d.com) and will be deprecating the old Unity Ads Admin (http://unityads.unity3d.com) as more features become available in the new the new Admin. Some features may not be fully functional as we bring them online early on. We will be working quickly to sort out the bugs. Please let us know if you have any concerns by email or contacting us through the Unity Ads Admin.
Disabling a platform will allow you to use the Advertisements.Initialize() method to initialize Unity Ads manually (in case >you have multiple game IDs per platform that you need to choose from at runtime).
I just tried this and while dummy ads are shown in the editor, when I build my iOS game with the iOS-Checkbox in Ads Services cleared and do manual initialization from code, it will throw an error:
“The type or namespace name `ShowResult’ could not be found. Are you missing a using directive or an assembly reference?”
I have included “usingUnityEngine.Advertisements” of course (ShowResult being a member of that namespace).
With the box in iOS Ads Services checked, it compiles fine but manual initialization does not work. With the Box checked and leaving out the iOS GameId in the appropriate field, I get
“UnityAdsEditor: Server returned error message: No numeric game id set, cannot send response” which is kinda expected and did not do the trick.
Thanks for the response. I think it would great for the Ads team to post a migration guide in the same way the Analytics team has.
Wow, I tried this several times, there’s something very broken about the way those input fields function in the OSX version of the Editor. It took me several attempts to make them accept input/overwriting, I’d actually tried this before and given up assuming they weren’t editable.
I’m just going to hope that after entering my existing game IDs it will continue to update the old dashboard and use that dashboard settings for the default zone etc. Please let us know if this isn’t expected!
Absolutely. I’m going to be posting an migration guide later today.
Yeah, I’m encountering the same issue. There appear to be a number of wonky issues like this with the UI in the new Services window. This will have to get fixed in a patch. Keep an eye on the release notes.
Entering your existing game IDs will continue to use and associate impression data and revenue with those game IDs. We’re currently shifting over to a new data model on the backend though, and will be building out the new Unity Ads Admin to support this data model and the UDN Organization / Project models.
This migration involves quite a bit of work. There may be some some issues affecting the Admin that pop up (like revenue dropping to $0.00) as we migrate accounts. All the data is still there in the system (revenue hasn’t disappeared), it’s just that some of the data might not be migrating at the same time as when the new data model is implemented. Don’t panic right away if you see something like this. If it doesn’t resolve itself within 72hrs, please email or contact us through the Unity Ads Admin.
Thanks for reporting these issue. The feedback is very helpful.
I setup my project ID, turned on Ads, clicked the dashboard, added two games to Ads (iOS and Android), and now in the Unity Services panel, I see nothing under the services, its just blank.
Online, in the dashboard, everything is there and working.
Pre-5.2, I was manually passing my IDs with Advertisement.Initialize() based on the platform and now I’m seeing these errors:
UnityAdsEditor: Server returned error message: No numeric game id set, cannot send response
UnityEngine.Advertisements.c__Iterator0:MoveNext()
UnityAdsEditor: Failed to fetch campaigns.
UnityEngine.Advertisements.c__Iterator0:MoveNext()
Should I just not use Advertisement.Initialize() anymore and let the new built-in services do it’s own initialize? If so, how can I enter the IDs if the panel is blank?
Unfortunatly, that is not the way how it works at the moment. Right now a little hack is needed to achieve manual initialization in Unity 5.2.
In the Unity Services-Tab it is important to have UnityAds turned on and the platforms (iOS and/or Android) selected, otherwise building will fail for missing Advertisment-Namespace
Find the file ProjectSettings/UnityAdsSetttings.asset and open it in a text editor
In the file, set m_InitializeOnStartup to 0 - that prevents buildin UnityAds to try initializing with the configured Ids in the Advanced Section of the Unity Services-Tab. The lack of any ids there leads to the “no numeric ids”-error by the way when m_InitializeOnStartup is set to 1.
Now manually passing Ids using Advertisement.Initialize() works again.
In Unity 5.2, should any background music be paused before displaying the advertisement?
I have a singleton Music Manager implementation that persists between scenes. If I play music in one scene, then change, the music keeps playing. If I choose to display the ad, then the music keeps on playing and does not pause or stop.
I am using unity remote to test and have the build settings set to iOS.
@madruse@actraiser3 : EDIT: Disabling either iOS or Android platforms under Ads in the Services window will strip the Unity Ads API from the build when building for the disabled platform. To manually initialize Unity Ads, you’ll need an editor script that disables the initializeOnStartup property of AdvertisementSettings. See the following post for details.
In Editor, the Unity Player is not paused when an ad (in this case a placeholder for an ad) is shown. The Unity Player is however paused when an ad is shown on device. To simulate this in editor, you could set the Time.timeScale to 0 and AudioListener.volume to 0 when the ad is shown. Then restore both values to 1f when the ad is closed. You can use the ShowOptions.resultCallback to handle restoring values, or check against Advertisements.isShowing.
Keep in mind, you would only need to simulate this in Editor. You wouldn’t need to run the same code on device.
@unity-nikkolai - I read this advise before but when I disable both platforms I get the following error when compiling for iOS: The type or namespace name `ShowResult’ could not be found. Are you missing a using directive or an assembly reference?
It works fine with the platforms enabled and (for manual initialization) turning m_InitializeOnStartup off in the asset. Note that in the Unity Editor, your suggestions works fine though. It looks to me that in my setup “Advertisements” is not available at compile time when the platforms are disabled in the Service Tab.
Maybe I don’t understand the concept entirely but I was under the impression that the plugin package must not be installed anymore (even for manual initialization) starting Unity 5.2 - so I removed it. Here are all my scenarios which I just tested one by one:
Manual Initialization does not work:
A. When I install the Unity Ads plugin from the AssetStore and the service Unity Ads is enabled (with both the platforms disabled as suggested by Nikolai), then I get the error: “The imported type `UnityEngine.Advertisements.ShowResult’ is defined multiple times”
B. When I do not install the Plugin Package from the Unity Store and Enable Unity Ads in the Service Tab but disable both platforms I get this error when building for iOS: The type or namespace name `ShowResult’ could not be found. Are you missing a using directive or an assembly reference? Manual Initialization Does Work
C. When I install Unity Ads from the Asset Store and disable Unity Ads in the Service Tab - everything works.
D. When I do not install the Plugin Package, enable Unity Ads in the Service Tab and activate both Platforms, it works after I set m_InitializeOnStartup to off, otherwise UnityAds tries to initialize automatically.
Currently I use scenario D - could you please clarify which the recommended way would be?
@unity-nikkolai
I have successfully integrated Unity Ads in my game but encounter some little difficulties. I have testmode on.
When users want to unlock some free upgrades they need to watch a video ad when completed they get there upgrade for an hour. I have currently set them to one minute just for testing. but sometimes even in testing mode there are no ads to be shown and isready gives me false in testing mode. But when I tap my iOS home button to suspend the app and resume again it works. I cannot figure this out.
@actraiser3 : I’ll need to verify this functionality. If this is the case, we’ll have to get this fixed in an upcoming patch release. Thanks for breaking this down.
@Tapgames : This is a known issue. It’s already fixed in the Unity Ads asset package, and should be fixed in an upcoming patch release of Unity. Thanks for reporting.
@actraiser3 : This analysis is spot on. Apparently this is expected functionality. Scenario C is currently the recommended use case. However, scenario D appears to work just fine as well. Thank you for sharing this with us.
Neither of these cases are satisfactory. I’m trying to determine now what the integration workflow should be moving forward, and what we need Unity Ads to supply functionality wise to support various types of integrations.
You can create an editor script that disables AdvertisementSettings.initializeOnStartup:
Enable Ads in Services window in Unity.
Create file Editor/BuildProcess.cs in the project with this code:
using UnityEditor;
using UnityEditor.Callbacks;
using UnityEditor.Advertisements;
public class BuildProcess : Editor
{
[PostProcessScene]
public static void OnPostprocessScene ()
{
AdvertisementSettings.enabled = true;
AdvertisementSettings.initializeOnStartup = false;
}
}
Call Advertisement.Initialize() the usual way to initialize Ads.
@unity-nikkolai Thank you for checking and the Editor-Script. What I would like to suggest is that there should be a standardized way for all current and future integrated Unity services (Ads, Analytics, Cloud Build,…) to configure and initialize service ids adhoc from script and not tie a Unity project 1:1 to a service.
In my case, I create many different versions of an app from a single Unity Project, that is for different platforms, different audiences (e.g. variations in culture/localization, beta versions) with different feature-sets (e.g. paid vs free). I would like to have control over the used Unity Services for each of the versions of a game, that is, to have the freedom to use different project ids for the services as needed when running the game.
In other words, imho all Unity Services should be created with multi-client support per project in mind.
Please, you have thousands of users, can you organize it better?
Create an official youtube channel, make 3 videos:
1 explaining the new procedures for new projects,
2 Showing migration from previous unity ads
Another one, on how to reset and restart unity ads that doesn’t show anything anymore, once you project is a mess.
And give it a status of beta if you need thousands of workarounds to make it work, so we can choose another ads providers.
official documentation has 3 lines with very poor explanation… now there is a new dashboard and the old still works…
you have a 50 minute official tutorial for ads integration, but everything has changed and no warnings there at all.
For new users like me its a nightmare.
It’s very disapointing.
I had a project working with 5.1 but I was stupid enough to update it, now ads doesn’t work and I have to remake all the code… after that a lot of errors with the new dashboard. I deleted the old project from unity ads dashboard and create a new one, but now I cannot see it inside unity services anymore and keep giving me the error: Unfortunately your project cannot use the new UnityDashboard yet. How to restart all of it, without loosing all my work?