UnityAds and Cocos2d

Looks like UnityAds are the best way to do full frame ads right now, here’s some notes about getting it to compile with cocos2d (integration is stuff for another post!)

Short version:

  • Follow this guide
  • Use Cocos3
  • Build project with spritebuilder
  • Add 2 extra frameworks; CoreTelephony and SystemConfiguration

Longer version

Basic outline is here: https://unityads.unity3d.com/help/Documentation%20for%20Publishers/Integration-Guide-for-iOS

Few things we discovered after the fact:

  • UnityAds uses chipmunk, so you need to be running a cocos2d-with-chipmunk project
  • Cocos2d v3 runs this way by default, which is nice, but we were using cocos3d v2, doh
  • Having not setup a fresh cocos2d project for a while, went from half-remembered notes; downloaded the latest┬ásetup, installed the xcode templates, build fresh, failed compile, arrgh
  • Forum search revealed the xcode templates have been depreciated for a while, and definitely don’t work. Instead, use spritebuilder to make a project, that does the right thing
  • Now we had a clean cocos2d v3 project that would build and run, nice
  • Add unityads as described in the link above, build fail again, ugghh. All linking errors related to x86_64
  • Few false starts trying to remove mac and debuild targets, found the real culprit; Unityads expects more frameworks to be incorporated than the guide lets on (I’m guessing if you create a game with the unity editor, it’ll include all the right frameworks for you)
  • For each error, google for “ThatMysteryClassError framework”, find the name, add it. In this case, it was CoreTelephony and SystemConfiguration.

Leave a Reply