googleads-mobile-unity icon indicating copy to clipboard operation
googleads-mobile-unity copied to clipboard

GoogleMobileAdsSettings in Editor folder

Open metagamejsc opened this issue 8 months ago • 1 comments

[REQUIRED] Step 1: Describe your environment Unity version: All Google Mobile Ads Unity plugin version: 9.6.0 Plugin installation method: Both (Unity package manager, .unitypackage import) Platform: iOS, Android (iOS, Android) Platform OS version: All Any specific devices issue occurs on: All Mediation ad networks used, and their versions: None

[REQUIRED] Step 2: Describe the problem Steps to reproduce: Create an empty project, import GoogleMobileAds plugin.

Attach script to a gameobject in scene

using UnityEngine;

public class LoadResource : MonoBehaviour
{
    // Start is called once before the first execution of Update after the MonoBehaviour is created
    void Start()
    {
        ScriptableObject[] so = Resources.LoadAll<ScriptableObject>("");
    }
}

When running the build on an Android or iOS device I get this error in the console:

A scripted object (script unknown or not yet loaded) has a different serialization layout when loading. (Read 56 bytes but expected 132 bytes)
Did you #if UNITY_EDITOR a section of your serialized properties in any of your scripts?

The problem is that the GoogleMobileAdsSettings class file is in an Editor folder (which gets stripped out at build time) and GoogleMobileAdsSettings scriptable object file is in a normal Resources folder (so this gets included in the build).

metagamejsc avatar Mar 26 '25 02:03 metagamejsc

This leads to the problem that the App-ID is reset every time we close and open a project with admob (even though the data is properly serialized it can not be derserialized) - so in order to build an application you need to delete + recreate the settings on every unity restart

Inspyro avatar May 27 '25 11:05 Inspyro

I will be closing this issue, but the issue is logged and the team will look into this.

NVentimiglia avatar Jul 25 '25 21:07 NVentimiglia