Exclude SDKs / folder from build targets

Hi

Unity is a cross platform game engine. But how come it is so difficult to exclude some folders from a certain target?
For example:
I want the Oculus SDK in the Android Target (for Oculus Quest), but perhaps not when I’m building another scene from that project to iOS or WebGL…

[Should I create a custom build pipeline that excludes folders by adding a tide to the folder name before building, and then removing after building]( Excluding folders from build page-2#post-6046250)? That seems hacky.

Or should I compile my scenes that target different targets, into asset bundles that get built into the final solution? Seems hacky for such an important thing

Or should I compile it into an assembly?

Or add platform dependant flags to every script in the Oculus SDK?

Or is there a better way? :smile:
I’d love to see the same setup as the plugins folder. E.g. you dump stuff in a platform specific folder.

Hello, did you find a solution ?

I have a suggestion I have not tested so far : maybe symbolic link that you would change when changing targets would do the trick:

Directories:
Assets
TOTO_OCULUS
TOTO_ANDROID

Android build: Assets\toto → TOTO_ANDROID
Oculus build: Assets\toto → TOTO_OCULUS

switch_target_oculus.bat:
mklink /D Assets\toto TOTO_OCULUS

switch_target_android.bat:
mklink /D Assets\toto TOTO_ANDROID

On Linux or MacOSX, use “ln -s” command instead of “mklink /D”

I have the same problem!

Did you found a solution that works?