B
B
Booba123245672021-03-05 13:46:35
Unity
Booba12324567, 2021-03-05 13:46:35

How to make it so that when viewing ads they give + 1 point?

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Advertisements;
using UnityEngine.UI;

public class UnityAds : MonoBehaviour, IUnityAdsListener
{
    
    string placement = "rewardedVideo";
    public Text moneyTxt;
    

    void Start()
    {
        Advertisement.AddListener(this);
        Advertisement.Initialize("------", true);
    }


    public void OnUnityAdsDidFinish(string placementId, ShowResult showResult)
    {
        if (showResult == ShowResult.Finished)
        {
            moneyTxt.text = "<size=40><color=#D79242>Money:" ;
        }
        else if (showResult == ShowResult.Failed)
        {
            //On no!
        }
    }

    public void OnUnityAdsDidStart(string placementId)
    {
    }

    public void OnUnityAdsReady(string placementId)
    {
    }

    public void OnUnityAdsDidError(string message)
    {
    }
    void UnityAdd()
    {
        Advertisement.Initialize("4037106", true);
    }

    public void ShowUnityAD(string p)
    {
        Advertisement.Show(p);
    }
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
freeExec, 2021-03-05
@Booba12324567

If (ПросмотрРекламыЗавершён && ПользовательДосмотрелЕёДоКонца)
{
    Score++;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question