Search Unity

Help finding a decent how to guide for chartboost reward videos

Discussion in 'Scripting' started by FranticThumbs, May 12, 2017.

  1. FranticThumbs

    FranticThumbs

    Joined:
    Mar 5, 2015
    Posts:
    58
    Hey all

    Can anyone point me in the direction of a good 'how to' guide for Chartboost reward videos? I've managed to get the standard adverts showing and tried to follow the same method - but it doesn't work. No ad displays. (I have already set up things in Chartboost dashboard to display ads)

    The button works and I have attached the script etc but nada.

    Code (CSharp):
    1. public class RewardVideo : MonoBehaviour
    2. {
    3.  
    4.     // Use this for initialization
    5.     void Start ()
    6.     {
    7.         Chartboost.showRewardedVideo(CBLocation.Default);
    8.  
    9.     }
    10.  
    11.     // Update is called once per frame
    12.     public void ShowRewardedVideo()
    13.     {
    14.         if (Chartboost.hasRewardedVideo(CBLocation.Default))
    15.         {
    16.             Chartboost.showRewardedVideo(CBLocation.Default);
    17.         }
    18.  
    19.     }
    20. }
    I have no idea where I am going wrong. Default is the main menu where the button is located.

    Many thanks
    (The reason for not using Unity Ads is that it doesnt support Amazon right now)
     
  2. Brathnann

    Brathnann

    Joined:
    Aug 12, 2014
    Posts:
    7,188
    I haven't used Chartboost(or heard of it). But I was curious what part of Unity Ads doesn't work with Amazon?
     
  3. FranticThumbs

    FranticThumbs

    Joined:
    Mar 5, 2015
    Posts:
    58
    Chartboost has been around for ages and pays well on Amazon apps. Unity Ads only display adverts for games on iOS or Google Play - not Amazon Appstore
     
  4. Brathnann

    Brathnann

    Joined:
    Aug 12, 2014
    Posts:
    7,188
    Ah, got you. That's interesting to know as well actually.

    Based on Chartboost guide https://answers.chartboost.com/hc/en-us/articles/201220275#unity-rewarded-video

    It looks like you're suppose to cache your videos, so I'm guessing if you don't have a video to play, that is why it's not working for you? I see they are doing calls to cache the video if one isn't there.
     
  5. FranticThumbs

    FranticThumbs

    Joined:
    Mar 5, 2015
    Posts:
    58
    Yeah I did try that and it didnt work either lol.

    It's probably staring at me right in the face - and looking at the example script, just made me dizzy. I havent played with Unity for a while and diving back in but the important part - money - there's not too many decent tutorials out there.
     
  6. FranticThumbs

    FranticThumbs

    Joined:
    Mar 5, 2015
    Posts:
    58
    LOL it was. I changed the location to Mainmenu and added the cache line again and bingo. Now I just have to figure out how to give the player the reward
     
  7. Brathnann

    Brathnann

    Joined:
    Aug 12, 2014
    Posts:
    7,188
    Nice! Looks like it tells you in that doc the callback that you can use to check that it's time to give an award. I'm assuming it only calls that method if it finished the video, but I'm not sure if CBLocation gives a status in it on what happen (in case the video was cancelled or failed to play all the way).

    I will say sometimes throwing code into a text compare will help you find the differences as well. I've had to do that a couple of times in the past. (especially when tired!)