Saturday, January 3, 2015

Chartboost Unity3D integration tutorial

Okay, now I will try to write how to integrate Chartboost into Unity

INSIDE chartboost account
------------------------------------
step1: Under app -> add app
-> platform: IOS
-> nickname: zombie spitter
-> test mode: enabled
-> click next next next DONE

step2: Under campaign -> add campaign -> publish in network
-> Ad type: reward video (my personal preference, ask user watch video, then you give them reward)
-> click save

step3: Go back to app -> overview
-> hover your mouse to the app and copy out the APP ID and APP SIGNATURE






INSIDE UNITY
----------------------
step1: create a new unity project

step2: download the chartboost SDK from chartboost website and import into your project

step3: double click the Example folder -> chartboostexample scene

step4: on top Chartboost -> Edit setting
-> put in your APP ID and APP SIGNATURE you created earlier in your chartboost account

step5: build setting -> build
-> make sure app name 100% match your chartboost account app name
-> make sure bundle id 100% match itune connect

step6: after you build finish, open xcode, plug in your iphone and click play

step7: test the ad in your iphone, make sure everything work correctly

step8: after you are satisfy, you can go back to chartboost account and tick "TEST DISABLE" for the real ad to come




Chartboost function for dummy
---------------------------------------
I want to write this down to remind myself how to use it properly

1. Cache a reward video
Chartboost.cacheRewardedVideo(CBLocation.Default);

2. Check if the reward video 100% loaded before displaying your button
if(Chartboost.hasRewardedVideo(CBLocation.Default)==true)
{
//display your button here
}

3. Show a reward video
Chartboost.showRewardedVideo(CBLocation.Default);

4. Check if the user completed watching the video before you give them reward
//this one you just put your gems +=1 inside this function

void didCompleteRewardedVideo(CBLocation locationint reward
    {
        Debug.Log(string.Format("didCompleteRewardedVideo: reward {0} at location {1}"rewardlocation));

        gems+=1;
    }





No comments:

Post a Comment