Search code examples
c#unity-game-engineads

Unity Reward Ads script is not working ,_adUnitId is defined and it says it's not defined


I copied this code from their docs: https://docs.unity.com/ads/ImplementingRewardedAdsUnity.htm

I doesn't make sense _adUnitId is defined and it says it's not defined.

Code


Solution

  • @siusiulala is right I had to put the code in a function so I put it in awake function for it to work.

    Alternatively change to release mode from debug and error should disappear.