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. Dismiss Notice

Unity ads stack rewarded video effects

Discussion in 'Unity Ads & User Acquisition' started by dimex472, Aug 14, 2020.

  1. dimex472

    dimex472

    Joined:
    Jun 18, 2020
    Posts:
    7
    Good afternoon. In the process of integrating rewarded video into a unity game, I came across the fact that if there is more than one button with rewarded video in one scene, then the effects stack and overlap each other. I guess that the problem is in event listeners (Although the documentation clearly says: SDK versions 3.1+ allow you to register multiple listeners). I tried to write some method to control listeners, but they die every other time. Maybe someone can suggest a less painful way to integrate rewarded video more than 1 into 1 scene (since I have the whole game in one scene).
     
  2. sbankhead

    sbankhead

    Unity Technologies

    Joined:
    Jul 27, 2014
    Posts:
    97
    So you need to control your listeners in each scene. Whats likely happening is your in scene 1 and you add a listener. Then you transition to scene 2 and add a listener. When you next get an event, both listeners will be triggered. The SDK only knows your finished with the listener from scene 1 if you call removeListener.

    tldr; All listeners are called for every event we fire, so call removeListener if you no longer want that listener to be called anymore.
     
  3. dimex472

    dimex472

    Joined:
    Jun 18, 2020
    Posts:
    7
    Thanks a lot for your reply! I was construct some switch-case state pattern with removing and adding listeners. But sometimes I am facing with issue, what some listeners are not deleted. What can be related with that?
    Also, I don't have scenes separation and all my game is a one whole scene with some dialogues windows.
     
    Last edited: Sep 7, 2020