Memory problem Unity Ads on Android
Each time I call Advertisement.Show(null, showOptions); total memory increases by 20Mb and eventually the app freezes or restarts. I’ve tested this on HTC and Samsung S3. What am I doing wrong?
Here is my code:
public void ShowAds(Action onFinished = null, Action onSkipped = null, Action onFailed = null, Action onComplete = null)
{
if (Advertisement.isReady())
{
UserInterface.Instance.setTouchInput(false);
Advertisement.Show(null, new ShowOptions
{
pause = true,
resultCallback = delegate(ShowResult result)
{
Debug.Log("Unity Ads : " + result.ToString());
switch (result)
{
case ShowResult.Finished:
if (onFinished != null)
onFinished();
break;
case ShowResult.Skipped:
if (onSkipped != null)
onSkipped();
break;
case ShowResult.Failed:
if (onFailed != null)
onFailed();
break;
default:
throw new ArgumentOutOfRangeException("result");
}
UserInterface.Instance.setTouchInput(true);
if (onComplete != null)
onComplete();
}
});
}
}