Skip to content

Fix asmdef includePlatforms (exclude unsupported platforms like WebGL/Windows) #465

@vizgl

Description

@vizgl

Please restrict asmdef files to only the platforms they actually support.
My game targets Android, iOS, WebGL, and Windows. Google Ads is supported on Android/iOS only. When building WebGL (and similarly Windows), the project fails because some asmdefs compile on all platforms while their dependencies compile only on Android/iOS.

Problem
Example:

  • GoogleMobileAds.Mediation.IronSource.Api.asmdef — currently supports all platforms and references
    GoogleMobileAds.Mediation.IronSource.Mediation.asmdef.
  • GoogleMobileAds.Mediation.IronSource.Mediation.asmdeflimited to "Editor", "Android", "iOS".

When building for WebGL, the Api assembly is compiled, but the Mediation assembly is not, which results in missing types/references and the build fails. To ship a WebGL build I currently have to remove these packages from the project.

Steps to Reproduce

  1. Open a Unity project that includes the IronSource mediation for Google Mobile Ads.
  2. Set Build Target to WebGL.
  3. Build the project.
  4. Observe compile errors about missing classes referenced from GoogleMobileAds.Mediation.IronSource.Mediation.

Expected Behavior
WebGL/Windows builds succeed without manual package removal because mobile-only code is excluded.

Actual Behavior
Build fails due to missing references from mediation assemblies that aren’t compiled on WebGL/Windows.

Proposed Fix
Limit affected asmdefs to the platforms they support, e.g. set includePlatforms to Android and iOS for runtime/mobile-only assemblies (and split out any Editor code into a separate .Editor.asmdef if needed).

Minimal example change:

// GoogleMobileAds.Mediation.IronSource.Api.asmdef (before)
{
  "name": "GoogleMobileAds.Mediation.IronSource.Api",
  "references": [ "GoogleMobileAds.Mediation.IronSource.Mediation" ],
  "includePlatforms": [] // all platforms (causes WebGL/Windows to compile this)
}

// After
{
  "name": "GoogleMobileAds.Mediation.IronSource.Api",
  "references": [ "GoogleMobileAds.Mediation.IronSource.Mediation" ],
  "includePlatforms": [ "Android", "iOS" ] // excludes WebGL/Windows
}

Alternatively, ensure the top-level API asmdef does not compile on platforms where its dependencies are excluded, or use an Editor-only asmdef for tooling code (includePlatforms: ["Editor"]).

Request
Please update the asmdef files to exclude unsupported platforms (at least WebGL and Windows) so non-mobile builds don’t fail. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions