Search Unity

Feedback AssetBundles with shaders for all standalone platforms

Discussion in 'Asset Bundles' started by Alloc, Jun 17, 2019.

  1. Alloc

    Alloc

    Joined:
    Jun 5, 2013
    Posts:
    228
    Hi,

    one of our biggest gripes with the current system to build AssetBundles is that we have to select one of the BuildTargets, i.e. Windows/Linux/macOS for us. It looks like the only difference between them are the shaders though that are obviously missing if the selected target did not have the rendering API as the platform that is using the bundle (e.g. building a Windows bundle and running on macOS + Metal). Everything else seems to be fine though, e.g. having a Windows bundle and the Windows settings include DX, Vulkan, GLCore and then use it on Linux with either the GLCore or Vulkan backend.

    Now for us ourselves we could obviously change our build process to create our bundles three times, one for each target platform. That's really mostly just an annoyance as it would take a while longer for a build to be created, but not hurt us any further.

    The bigger issue is coming up when we look at modders. We want our game to be as modding friendly as possible and that includes our users to be able to build new assets, and the only feasible way for that seems to be having them create bundles. But for one they will likely not be aware of that issue, furthermore not even interested in supporting all platforms. Also it would be an issue for distribution and making sure every user of such a mod would get the appropriate bundles.


    It would be really nice if we could select multiple BuildTargets at once or specify the graphics APIs when building so the other shaders get included too. At least for the PC platforms it seems that's the only issue with sharing the same bundles.

    TLDR: Please add an option to the BuildPipeline.BuildAssetBundles methods to either specify multiple BuildTargets or allow specifying the GraphicsDeviceTypes so that we can include more shader targets in a single bundle for (standalone) platform compatibility :)

    Regards,
    Chris
     
  2. andyz

    andyz

    Joined:
    Jan 5, 2010
    Posts:
    1,101
    This is a terrible area of asset bundles - we use them for models and just load one bundle on any standalone platform then do a material replace by name. This kind of works but you can get shader warnings on loading before assigning new materials.
    If the shaders have to be stored in a compiled state then they should indeed be stored for all possible platforms, better for models would be to store the materials as simple descriptions and then create the materials the other end.