Tag-based gameobject exclusion

Hello,

I need to make a scene that includes platform-specific assets. There are several ways to achieve that, including (but not limited to):

  1. putting all resources in the scene as inactive, then activate the relevant one in the Awake of some “manager” object

  2. putting all resources in the scene as active, then attach each of them a monobehaviour that destroy them (or make them inactive) if they are not relevant

  3. moving the assets in the Resources folder and load them as needed

Neither of these solutions is optimal. 1 and 2 will require unnecessary loading the unneeded resources, while 3 will require a call to Resources.Load which is blocking, thus making LoadLevelAsync pointless.

However, all three solutions have a bigger drawback: all the resources (needed and unneeded) will be built and will therefore end up in the final executable. I’d like to avoid that.

I see that there is a built-in tag EditorOnly that you can use to strip a gameobject (and its children) during the build process. Is there something similar that could be used?

Found that you can do almost everything by simply exploiting the PostProcessScene attribute.