私はRevmob Unity Pluginを統合し、ほぼ8から10個のフルスクリーンビデオを実行しています。その後、静的または動画のインタースティシャルをダウンロードしていないため、「RAMがいっぱいで何もダウンロードできません」と表示されます。 スタティックとビデオの両方でRelease()を呼び出そうとしましたが、何も動作していないようです。Revmob UnityのAndroidでのメモリ不足
私は8~10のビデオを繰り返しキャッシュして再生すると、うまく動作します。その後、完全に停止します。私はそれを取り戻すことを期待し、ほぼ1〜2時間待ったが、
が、これは
ラファエルが、私はこの一つ一つの時間を再現することができユニティrevmobプラグインにおける問題???? :(です。私はこれを試してみました3つのデバイスで。私は1ギガバイトのRAMとサムスンメガ5.8で8本のビデオを見た後に、この問題を再現することができます。
を4ギガバイトのRAMを搭載したASUSのzenphoneでは、RAMの使用量が20〜30本の動画を再生した後、増加を見ることができます。
BTW私は他の広告ネットワークの統合に疑念を抱いていたので、この問題を再現するためにすべての広告ネットワークを削除し、このネットワークのみをテストしました。
私は少し質問があります: RevmobFullScreenクラスでのRelease()メソッドの使い方は何ですか?私はあなたのサンプルファイルでそれを使用している人を見つけることができません。 ClickonadとClosead関数の後にRelease()を使用して私は5〜6のビデオを再生でき、Release()コールがなければ8〜10のビデオを再生できます。 Release()を使用してメモリが解放されることはありません。このメソッドをオプションと呼びますか、それとも副作用がありますか?
また、ビデオを閉じたり、広告をクリックした後に繰り返しキャッシュすると、メモリリークが発生しますか?これは私がRevmobに何もしていない唯一のことです。
参考までに私のコードを添付しています。
using UnityEngine;
using System.Collections;
using System;
using System.Collections.Generic;
public class RevmobController : BaseController, IRevMobListener {
private Dictionary<string, string> REVMOB_APP_IDS;
private static RevMob revmob;
private static RevMobBanner banner;
private static RevMobFullscreen fullscreenStatic;
private static RevMobFullscreen fullscreenVideo;
public bool bannerAdsOnBootup;
public bool interstitialAdsOnBootup;
private bool fullscreenStaticAvailable;
private bool fullscreenVideoAvailable;
public bool createBanner;
private static RevmobController adsController;
public string androidMediaId;
public string iosMediaId;
private enum TYPE_OF_AD {STATIC, VIDEO};
private TYPE_OF_AD typeOfAd;
public static RevmobController SharedInstance() {
return adsController;
}
void Awake() {
adsController = this;
DontDestroyOnLoad(adsController);
REVMOB_APP_IDS = new Dictionary<string, string>() {
{ "Android", androidMediaId},
{ "IOS", iosMediaId }
};
revmob = RevMob.Start (REVMOB_APP_IDS, gameObject.name);
}
// Use this for initialization
void Start() {
}
public bool ShowFullscreenStatic(string location)
{
if(!fullscreenStaticAvailable) {
return false;
}
this.location = location;
StartCoroutine(LoadInterstitial(location));
return true;
}
IEnumerator LoadInterstitial(string location) {
yield return null;
fullscreenStatic.Show();
}
public bool ShowFullscreenVideo(string location)
{
if(!fullscreenVideoAvailable) {
return false;
}
this.location = location;
StartCoroutine(LoadVideoInterstitial(location));
return true;
}
IEnumerator LoadVideoInterstitial(string location) {
yield return null;
fullscreenVideo.ShowVideo();
}
public void CacheStaticInterstitial(string location) {
if(!AdsService.SharedInstance().IsInternetConnected()) {
return;
}
DestroyStatic();
StartCoroutine(CacheAfterEndofFrame(location, TYPE_OF_AD.STATIC));
}
public void CacheVideoInterstitial() {
if(!AdsService.SharedInstance().IsInternetConnected()) {
return;
}
DestroyVideo();
StartCoroutine(CacheAfterEndofFrame(location, TYPE_OF_AD.VIDEO));
}
IEnumerator CacheAfterEndofFrame(string location, TYPE_OF_AD typeOfAd) {
yield return null;
this.typeOfAd = typeOfAd;
if(typeOfAd == TYPE_OF_AD.STATIC) {
fullscreenStatic = revmob.CreateFullscreen(location);
} else {
fullscreenVideo = revmob.CreateVideo(location);
}
}
public void SessionIsStarted()
{
Debug.Log("Session started.");
if(createBanner) {
banner= revmob.CreateBanner();
}
CacheStaticInterstitial("Bootup");
CacheVideoInterstitial();
if(bannerAdsOnBootup && banner != null) {
if (PlayerPrefs.GetInt("removeads",0) == 0) {
banner.Show();
}
}
}
public void SessionNotStarted (string revMobAdType)
{
Debug.Log("Session not started.");
}
public void AdDidReceive (string revMobAdType)
{
Debug.Log("Ad did receive.");
if(typeOfAd == TYPE_OF_AD.STATIC) {
fullscreenStaticAvailable = true;
} else if(typeOfAd == TYPE_OF_AD.VIDEO) {
fullscreenVideoAvailable = true;
}
if(interstitialAdsOnBootup) {
ShowFullscreenStatic("Bootup");
interstitialAdsOnBootup = false;
fullscreenStaticAvailable = false;
}
}
public void AdDidFail (string revMobAdType)
{
Debug.Log("Ad did fail.");
}
public void AdDisplayed (string revMobAdType)
{
Debug.Log("Ad displayed.");
AdsService.SharedInstance().PauseAudio();
}
public void UserClickedInTheAd (string revMobAdType)
{
Debug.Log("Ad clicked.");
if(typeOfAd == TYPE_OF_AD.STATIC) {
fullscreenStaticAvailable = false;
DestroyStatic();
//CacheStaticInterstitial();
} else if(typeOfAd == TYPE_OF_AD.VIDEO) {
fullscreenVideoAvailable = false;
DestroyVideo();
//CacheVideoInterstitial();
}
}
public void UserClosedTheAd (string revMobAdType)
{
Debug.Log("Ad closed.");
AdsService.SharedInstance().ResumeAudio();
CallOnAdComplete(this.location);
if(typeOfAd == TYPE_OF_AD.STATIC) {
fullscreenStaticAvailable = false;
DestroyStatic();
//CacheStaticInterstitial();
} else if(typeOfAd == TYPE_OF_AD.VIDEO) {
fullscreenVideoAvailable = false;
DestroyVideo();
//CacheVideoInterstitial();
}
}
void DestroyStatic() {
if(fullscreenStatic != null) {
//fullscreenStatic.Hide();
//fullscreenStatic.Release();
//fullscreenStatic = null;
}
}
void DestroyVideo() {
if(fullscreenVideo != null) {
//fullscreenVideo.Hide();
//fullscreenVideo.Release();
//fullscreenVideo = null;
}
}
public void VideoStarted() {
}
public void VideoFinished() {
//fullscreenVideoAvailable = false;
/*fullscreenVideo.Release();
fullscreenVideo = revmob.CreateVideo();*/
}
public void VideoLoaded() {
fullscreenVideoAvailable = true;
}
public void VideoNotCompletelyLoaded() {
}
public void RewardedVideoLoaded() {
}
public void RewardedVideoNotCompletelyLoaded() {
}
public void RewardedVideoStarted() {
}
public void RewardedVideoFinished() {
}
public void RewardedVideoCompleted() {
}
public void RewardedPreRollDisplayed() {
}
void OnDestroy() {
if(banner != null) {
//banner.Release();
}
if(fullscreenVideo != null) {
//fullscreenVideo.Release();
}
if(fullscreenStatic != null) {
//fullscreenStatic.Release();
}
adsController = null;
}
}
ラファエル、もう一度質問してください。私はそれを編集し、私のコード全体を投稿しました。あなたはチェックして、コードに問題があるかどうかを教えてください。 – Kenshin
と9.2.0はいつリリースされますか? – Kenshin
これについての返信 – Kenshin