Get the latest SDK here.
Requirements
Please note that Chartboost supports Android 2.3+ and iOS 6.0+, so make sure to set the minimum OS versions of your Unity project accordingly.
Key differences
- Initialization is handled by the SDK
- To simplify the integration and decrease possible issues post launch
- Chartboost Menu item
- Easier setup and control of AppID/AppSignature pairs
namespace Chartboost
renamed tonamespace ChartboostSDK
- In C#, it is not recommended to have the same name for the namespace as well as for a class (class
Chartboost
provides the public API functions)
- In C#, it is not recommended to have the same name for the namespace as well as for a class (class
null
/()
no longer accepted as a location – you can pass inCBLocation.Default
instead- Though we still have a default location, we encourage the use of more descriptive location names via the CBLocation class in order to provide more meaningful analytics
- All locations are now passed in via the CBLocation class
- The CBLocation class has several common location preset values available for use
- Custom location strings are now passed in via the CBLocation class’ locationFromName(string) method
- Chartboost SDK event names and method signatures have been significantly updated and improved
- Brings API and functionality more in parity with Native SDKs
- For more about the event functionality available, both old and new, please see the README.md file.
- CBBinding.cs is essentially replaced by Chartboost.cs. If you used to call CBBinding.isImpressionVisible() then you’ll now want to call Chartboost.isAnyViewVisible() — see Chartboost.cs for all available methods.
Upgrading to 6.x
- Delete old plugin folders:
PluginsAndroid
//Android SDK filesPluginsiOS
//iOS SDK filesPluginsChartboost
//Sample project- Import the new SDK package:
- Assets > Import Package > Custom Package
- Navigate to the .unitypackage file you downloaded from Chartboost and use that
- Select Import to complete the action (by default all package assets are marked for import)
- Drag and drop the Chartboost prefab to your game scene from
/Assets/Chartboost/Chartboost
- Select menu item
Chartboost > Edit Settings
: - Press the
Setup Android SDK
button in ChartboostSettings in the Inspector window - Edit the AppID & AppSignature settings with your current values for each platform
- Rename all
using Chartboost;
lines tousing ChartboostSDK;
- Rename all
CBManager.CBImpressionError
references toCBImpressionError
- Remove the following chartboost init code in
OnEnable()
: -
void OnEnable() { // Initialize the Chartboost plugin #if UNITY_ANDROID // Replace these with your own Android app ID and signature from the Chartboost web portal CBBinding.init("CB_APP_ID_ANDROID", "CB_APP_SIG_ANDROID"); #elif UNITY_IPHONE // Replace these with your own iOS app ID and signature from the Chartboost web portal CBBinding.init("CB_APP_ID_IOS", "CB_APP_SIG_IOS"); #endif }
- Remove any Android-specific Chartboost lifecycle code (Back button handling, pause, destroy, etc.) as found in the following Unity functions:
-
#if UNITY_ANDROID public void Update() { if (Input.GetKeyUp(KeyCode.Escape)) { if (CBBinding.onBackPressed()) return; else Application.Quit(); } } void OnApplicationPause(bool paused) { // Manage Chartboost plugin lifecycle CBBinding.pause(paused); } void OnDisable() { // Shut down the Chartboost plugin CBBinding.destroy(); } #endif
- Edit old Chartboost calls from
CBBinding.showInterstitial(YOURLOCATIONHERE);
toChartboost.showInterstitial(YOURLOCATIONHERE);
CBBinding
renamed toChartboost
- For all
null
and()
empty locations useCBLocation.Default
instead - Consider using one of CBLocation’s many preset values, for example
CBLocation.Startup
,CBLocation.LevelComplete
, orCBLocation.MainMenu
- If still using custom location strings, pass them in via CBLocation:
CBBinding.showInterstitial("customLocation");
becomesChartboost.showInterstitial(CBLocation.locationFromName("customLocation"));
- If you’re explicitly checking for already cached ads, the method used for this has had its name changed:
- Edit your calls from
CBBinding.hasCachedInterstitial(YOURLOCATIONHERE)
toChartboost.hasInterstitial(YOURLOCATIONHERE)
- If you’re listening to Chartboost events, these use
Chartboost
instead ofCBManager
and no longer have “Event” at the end of their names: - For example,
CBManager.didDismissInterstitialEvent += didDismissInterstitialEvent;
becomesChartboost.didDismissInterstitial += didDismissInterstitial;
- If you’re listening to Chartboost events, two events received more significant name changes that you’ll need to update with:
didShowInterstitialEvent
should be replaced withdidDisplayInterstitial
Don’t make cache or show calls inside
didFailToLoad
delegates or the universe will implode.Last Updated on May 18, 2017