Be patient..... we are fetching your source code.
Objectives
The main objective of this blog post is to explain how to implement Ads in Unity. This blog post is very useful to developers who don’t know anything about Ad or Ad Implementation in Unity using AdColony.
Here we go through the idea of how to implement Ad in unity by using AdColony SDK.
Unity supports many kind of Ad plugins. Here we are going to focus on how to implement it using AdColony.
Step 1 AdColony
This blog provide best practices for integrating video Ad. Any advertisers who are willing to report advertised app’s installation can use this SDK. This SDK basically provides video ads. Advertisers can implement any of them according to their requirement.
Step 2 Implementation
Following are the steps from which u can get brief idea about how to integrate AdColony SDK in Unity.
2.1 FIND OR CREATE YOUR APP ID
You can find/create your app IDs from following given link:
You can set video ads in your games using AdColony.
2.2 Download
You can download AdColony Unity Plugin from the following link:
2.3 Configuration
Installation process of Ad Colony Plugin contains the following steps. First of all, import the package that you have downloaded. If you don’t have any idea about importing packages in Unity,
Following link gives brief idea about it:
You can also download latest SDK as well as sample code example from Github via following link:
2.4 Setting up apps and zones
You can Create AdColony Video Ad using following line of code.
if (GameObject.Find ("<GAMEOBJECT_NAME>") == null) {
go = new GameObject ("<GAMEOBJECT_NAME>");
main = go.AddComponent ();
main.name = "<GAMEOBJECT_NAME>";
#if UNITY_ANDROID
main.Initialize(, <ANDROID_APP_ID>, <ANDROID_ZONE_ID>);
#else
main.Initialize (, <iOS_APP_ID>, <IOS_ZONE_ID>);
#endif
}
Note:
<GAMEOBJECT_NAME>must be unique. Make sure there is no object with <GAMEOBJECT_NAME> name.
<VERSION> : AdColony Version.
<ANDROID_APP_ID> : Your Android App ID.
<ANDROID_ZONE_ID> : Android Zone ID.
<IOS_ZONE_ID> : iOS Zone ID.
You can Show AdColony Video Ad using following line of code.
First you have to check for the video availability. If video is available, then call a method to show video ad.
AdColony.ShowVideoAd(<ZONE_ID>).
if (AdColony.IsVideoAvailable (<ZONE_ID>)) {
Debug.Log ("Playing AdColony Video1");
AdColony.ShowVideoAd (<ZONE_ID>);
} else {
Debug.Log ("Video1 is not Not Available");
}
Note:
Replace your Zone ID with <ZONE_ID>
2.5 Delegates
Delegates (which are also called Listeners/Callbacks) help you to follow Ad workflow. Whenever state of the Ad will change AdColony SDK will fore events respectively. It calls specific methods as per the callbacks. For example, if Ad is loaded successfully or not, you can identify whenever user click on Ad etc.
Following are the delegate method available for AdColony SDK:
- OnVideoStarted
- OnVideoFinished( bool ad_shown )
- OnV4VCResult( bool success, string currencyName, int amount )
- OnAdAvailabilityChange( bool available, string zone_id )
You can find out more details about AdColony Delegates - Callbacks from following link:
Checkout other Ads Implementation in Unity:
I hope you find this blog is very helpful while implementing Ads in Unity Using Adcolony. Let me know in comment if you have any question regarding Unity. I will reply you ASAP.
Got an Idea of Game Development? What are you still waiting for? Contact us now and see the Idea live soon. Our company has been named as one of the best Game Development Company in India.
I am 2D Game developer and iOS Developer with an aspiration of learning new technology and creating a bright future in Information Technology.
Ads Implementation in Unity Using AdMob
UIAlertController in Swift Tutorial