// Use this for initialization void Start() { showBtn.onClick.AddListener(showBtnClick); loadBtn.onClick.AddListener(loadBtnClick); //Notice: load Interstitial ad when you init UI. CTService.preloadInterstitialWithSlotId(slot_id); }
void Start() { playBtn.onClick.AddListener(playBtnClick); loadBtn.onClick.AddListener(loadBtnClick); //Notice: load rewardvideo ad when you init UI. CTService.loadRewardVideoWithSlotId(slot_id); }
void showBtnClick() { //you can also use this api to check if Interstitial is ready. if (CTService.isInterstitialAvailable()) { setReady(true, null); CTService.showInterstitial(); } else { Debug.Log("CT Interstitial is not ready"); } }
void playBtnClick() { //you can also use this api to check if rewearded video is ready. if (CTService.checkRewardVideoIsReady()) { setReady(true, null); CTService.showRewardVideo(slot_id); } else { Debug.Log("CT Rewarded Video is not ready"); } }
void Awake() { CTService.loadRequestGetCTSDKConfigBySlot_id(slot_id); CTService.uploadConsent("yes", "GDPR"); }
void loadBtnClick() { //load Interstitial ad CTService.preloadInterstitialWithSlotId(slot_id); Debug.Log("CT Interstitial loadBtnClick"); }
void OnDestroy() { //do not forget to call release, otherwise android platform will casue memory leak. CTService.release(); }
//Notice: You should call this api as soon as you can. For example, call it in Start function.(not in awake, beacause we must call CTService.loadRequestGetCTSDKConfigBySlot_id first in camera awake function) //For convenience test, we add a button to click. void loadBtnClick() { //load rewardvideo ad CTService.loadRewardVideoWithSlotId(slot_id); }