Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Asset bundle prefab with sprite renderer issues

Discussion in 'Asset Bundles' started by drulz, Mar 25, 2022.

  1. drulz

    drulz

    Joined:
    Feb 21, 2015
    Posts:
    29
    I created an asset bundle which contains a prefab from an image sprite, this asset bundle will be loaded remotely.
    to make sense, ofcourse the prefab and the original image sprite will be deleted in the project itself to save the game size.

    But deleting the asset and loading the asset bundle it gives us the error
    "
    Build.framework.js.gz:2
    Could not produce class with ID 212.
    This could be caused by a class being stripped from the build even though it is needed. Try disabling 'Strip Engine Code' in Player Settings."

    Doesnt this defeat the purpose of having an asset bundle in the first place? why in the hell does the original Sprites needs to be available IN the build where in the purpose of the build is to save loading time by reducing the size?

    im getting the error in WebGL build
     
  2. TobyKaos

    TobyKaos

    Joined:
    Mar 4, 2015
    Posts:
    214
    If you use assetbundles then the sprite will not be included in your build. And then when you load assetBundles then the sprite will appear without error.
    Do not erase it in your project.

    But if you include your sprite in Resources folder then I assume it will also be included. Put it in another naming folder.