Separate package manager for different platforms

My game uses the same project to export to WebGL, Android, iOS, PC and Mac with the use of platform dependent #define directives. This works perfectly for everything except packages. I haven’t found an elegant solution to this yet.

My WebGL builds aren’t working if I have the ads and purchasing packages in the project. I have tried to use a Pre-Export Method to remove “com.unity.ads” and “com.unity.purchasing” from “Packages/manifest.json” and “Packages/packages-lock.json” but the editor needs to restart for this to take effect.

There is the option of having a separate WebGL git branch but I would like to avoid that if possible. Is there another way to solve this?

Edit: I’d love to use more useful tags like “WebGL” and “packages” but it’s only letting me use “documentation”

Hi! you can use pre-build script to modify manifest