Unity ads in unity 2017.4.40f1 , hello guys I am newbie please help me out.
There is no package manager , to import the package. There are soo many toturials using many ways .i don’t know which way . please help me out
Hello, adarshdesai
Sorry to hear that you are having trouble implementing Unity Ads.
In Unity2017.4.40f1 you can use Unity Ads by turning on the Ads menu in the Services window.
Hope this helps. If you have any other questions please leave a comment.
Have a good day!
p.s: I understand you have a reason for using Unity2017.4.40f1, but I kindly recommend using the latest LTS version of Unity.
Hey thanks bro , but where is the sdk
Since you have turned on the Ads in Services, you already have the SDK, still able to use it.
However, the Advertisement SDK version is 2.0 in Unity2017.4 and the API is quite different from the latest version which is 3.7.5
Here is an example code of how to use Unity ads in Unity2017.4.
using UnityEngine;
using UnityEngine.Advertisements;
public class InterstitialAdExample : MonoBehaviour
{
[SerializeField] string _androidAdUnitId = "Interstitial_Android";
[SerializeField] string _iOsAdUnitId = "Interstitial_iOS";
string _adUnitId;
string gameId = "yourGameId";
bool testMode = true;
void Awake()
{
Advertisement.Initialize(gameId, testMode);
// Get the Ad Unit ID for the current platform:
_adUnitId = (Application.platform == RuntimePlatform.IPhonePlayer)
? _iOsAdUnitId
: _androidAdUnitId;
}
// Show the loaded content in the Ad Unit:
public void ShowAd()
{
// Note that if the ad content wasn't previously loaded, this method will fail
Debug.Log("Showing Ad: " + _adUnitId);
Advertisement.Show(_adUnitId);
}
}
If you copy-paste this code, change gameId, and trigger ShowAd()
, you will see the test ads as below.
You might want to check how other people implemented Unity Ads in Unity2017.
Hope this helps. And again, I kindly recommend using the latest LTS version of Unity.
Have a good day!
Thank you man
IT IS WORKING THANKS A LOT
Hey guys, does the Unity cookies dialog appears the first time you watch an Ad? It happens here and it messes with the callback, im getting OnUnityAdsShowFailure callback in my rewarded ads every time this dialog appears.
Any hint ? Thanks
No bro , not for me
So what happens to you? you dont get the unity cookies dialog? or your callback simply doesn’t fail if this dialog appears?
Thanks for your answer.
No I don’t get it , I have also implemented callbacks. So you just try showing your ads , and don’t implement callback and then try maybe
But you need the callback for the rewarded ads, otherwise you can’t know if the player has seen the ad or not for sure.