Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Question Cannot instantiate after switching scene when using Unity Mediation

Discussion in 'Unity Ads & User Acquisition' started by RecoHexa, Apr 6, 2023.

  1. RecoHexa

    RecoHexa

    Joined:
    Jun 18, 2022
    Posts:
    4
    So in my game, the player will be rewarded with in-game currency (let's just call it Gold) when they finish a level. This reward is calculated in the back end and then cause a prefab to spawn showing how much Gold the player gets and it gets added to their total Gold.

    We're preparing to offer the user to get 2x Gold when they watch ads as well as getting free Gold in the main menu, both of them using the same "Reward" prefab but we tweak the Gold value (1x for free, 1x for watching ad once). It's not finished in the back end so for now, we're printing a console log.

    The first time I watch the ad in the main menu, it works out. The console shows that user has been rewarded and our prefab spawns correctly. However, when switching to the game screen and trying to get 2x Gold ad, the reward prefab stops spawning. If I go back to the main menu and try to get the (non-ad) free Gold, the prefab does not spawn there either. The API and in-game shows no error. The prefab just simply does not spawn.

    Some details that might help:
    - I'm using mediation rewarded ad code generator, 1 for ios & 1 for android
    - I added void Start(){ InitServices() } to both of them
    - I have another script called ad manager that checks whether the user is using android/ios and show the user the android ad button for android and ios ad button for ios
    - I've seen that I need different rewarded ad units for different types of rewarded ads. Does this mean I need 2 different ad units for these? What if say I ask them to watch an ad so they can open lootboxes? Would I need 2 different ad units for this purpose?

    Sorry for the long post and thank you for reading.