You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Mediation ad networks used, and their versions: Only Google Admob
[REQUIRED] Step 2: Describe the problem
Steps to reproduce:
I created the following script in a new project
`using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using GoogleMobileAds.Api;
public class test : MonoBehaviour
{
// These ad units are configured to always serve test ads.
#if UNITY_ANDROID
private string _adUnitId = "ca-app-pub-3940256099942544/6300978111";
#elif UNITY_IPHONE
private string _adUnitId = "ca-app-pub-3940256099942544/2934735716";
#else
private string _adUnitId = "unused";
#endif
BannerView _bannerView;
public void Start()
{
// Initialize the Google Mobile Ads SDK.
MobileAds.Initialize(initStatus => { LoadAd(); });
}
// Update is called once per frame
void Update()
{
}
public void CreateBannerView()
{
Debug.Log("Creating banner view");
// If we already have a banner, destroy the old one.
if (_bannerView != null)
{
DestroyAd();
}
// Create a 320x50 banner at top of the screen
_bannerView = new BannerView(_adUnitId, AdSize.Banner, AdPosition.Top);
}
/// <summary>
/// Creates the banner view and loads a banner ad.
/// </summary>
public void LoadAd()
{
// create an instance of a banner view first.
if(_bannerView == null)
{
CreateBannerView();
}
// create our request used to load the ad.
var adRequest = new AdRequest();
// send the request to load the ad.
Debug.Log("Loading banner ad.");
_bannerView.LoadAd(adRequest);
}
/// <summary>
/// Destroys the banner view.
/// </summary>
public void DestroyAd()
{
if (_bannerView != null)
{
Debug.Log("Destroying banner view.");
_bannerView.Destroy();
_bannerView = null;
}
}
}
`
2.When running a scene, choose to mount this scripted game object.
3.Cancel the run, change the active of this gameobject in inspector to false and then to true, save the scene
4.The following error will be generated
Saving Prefab to immutable folder is not allowed: Packages/com.google.ads.mobile/GoogleMobileAds/Editor/Resources/PlaceholderAds/Banners/BANNER.prefab UnityEditor.EditorApplication:Internal_CallGlobalEventHandler ()
i'm having the same issue with almost identical setup on windows
Saving Prefab to immutable folder is not allowed: Packages/com.google.ads.mobile/GoogleMobileAds/Editor/Resources/PlaceholderAds/Rewarded/1024x768.prefab
UnityEditor.EditorApplication:Internal_CallGlobalEventHandler ()
@NVentimiglia
I think specifying the banner's position in new BannerView(_adUnitId, AdSize.Banner, AdPosition.Top); will affect the prefab's anchor. Please check the code if it's doing something like:
GameObject prefab = Resources.Load(PathToBannerPrefab)
prefab.GetComponent<RectTransform>().anchoredPosition... //change the prefab's properties instead of an instance of the prefab, if the code is doing this, it will cause error if the prefab is in Packages/ folder.
Instantiate(prefab); //creating an instance of the prefab
if it's doing that, please change the code to
GameObject prefab = Resources.Load(PathToBannerPrefab)
GameObject instance = Instantiate(prefab); //creating an instance of the prefab
instance.GetComponent<RectTransform>().anchoredPosition... //change the **instance** properties, this is the correct way
[REQUIRED] Step 1: Describe your environment
[REQUIRED] Step 2: Describe the problem
Steps to reproduce:
`using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using GoogleMobileAds.Api;
public class test : MonoBehaviour
{
// These ad units are configured to always serve test ads.
#if UNITY_ANDROID
private string _adUnitId = "ca-app-pub-3940256099942544/6300978111";
#elif UNITY_IPHONE
private string _adUnitId = "ca-app-pub-3940256099942544/2934735716";
#else
private string _adUnitId = "unused";
#endif
}
`
2.When running a scene, choose to mount this scripted game object.
3.Cancel the run, change the active of this gameobject in inspector to false and then to true, save the scene
4.The following error will be generated
Saving Prefab to immutable folder is not allowed: Packages/com.google.ads.mobile/GoogleMobileAds/Editor/Resources/PlaceholderAds/Banners/BANNER.prefab UnityEditor.EditorApplication:Internal_CallGlobalEventHandler ()
Here are the source files
归档.zip
The text was updated successfully, but these errors were encountered: