Cocos2dx animation lags behind whenever admob receives an ad
I am doing smooth CCScaleTo actions in my cocos2dx (v2.0.4) game scene. After adding admob (v6.2.1) to cocos2dx openGLView, actions are delayed whenever admob receives a new ad.
I am testing two cases:
- Remove the ad type from the presentation hierarchy. Animation lags when admob
loadRequst:
- Comment out admob
loadRequest:
and add ad view back to view the hierarchy. Animation lags during the first few seconds of loading the game scene.
It seems to be related to a UIKit and cocos2dx integration issue.
Any idea for a workaround?
source to share
Trick that comes to mind: Don't let AdMob render its own display (as it will insist on doing this animation). Instead, create an Adview and add it to your view hierarchy AFTER the normal animation finishes using ie dispatch_after
.
Ideally, you wrap UIView
in an object cocos2d
so that you CCDirector
can animate instead UIKit
. It might be more work than it costs, but it will definitely block the animation flow.
source to share