Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Voting for the Unity Awards are OPEN! We’re looking to celebrate creators across games, industry, film, and many more categories. Cast your vote now for all categories
    Dismiss Notice
  3. Dismiss Notice

.

Discussion in 'Scripting' started by NRSM, Aug 5, 2018.

  1. NRSM

    NRSM

    Joined:
    Jun 8, 2018
    Posts:
    26
    .
     
    Last edited: Feb 7, 2022
  2. Doug_B

    Doug_B

    Joined:
    Jun 4, 2017
    Posts:
    1,596
    Have your GameOverMenuManager class contain the necessary advert member variables. Within its
    Start()
    method have it perform all the appropriate initialisation using the advert API.

    In the GameOverMenuManager, have an OnEnable method something like this:
    Code (CSharp):
    1. void OnEnable()
    2. {
    3.     if (interstitial.IsLoaded())
    4.     {
    5.         interstitial.Show();
    6.     }
    7. }
    At some point you will need to deactivate the object (but after
    Start()
    has completed). Note: I am not sure if doing this will prevent the downloading of the ad in the background or not - so you may need to play around with it.

    As long as the advert downloaded then, when setting it to active, the IsLoaded check should then be true and the advert shown.

    Hopefully that gives you some ideas to work with?
     
  3. Doug_B

    Doug_B

    Joined:
    Jun 4, 2017
    Posts:
    1,596
    I would imagine that after the player has viewed the video, in an appropriate event handler (maybe
    HandleRewardBasedVideoClosed
    ), you would have a line of code something along the lines of
    player.AddOneLife();
    .