Search Unity

  1. Unity 2019.1 beta is now available.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. We're looking for insight from anyone who has experience with game testing to help us better Unity. Take our survey here. If chosen to participate you'll be entered into a sweepstake to win an Amazon gift card.
    Dismiss Notice
  4. On February 28th the Feedback website will shut down and be redirected to the Unity forums. See the full post for more information.
    Dismiss Notice
  5. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  6. Unity 2018.3 is now released.
    Dismiss Notice
  7. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice

Does variants work with prefabs in scene?

Discussion in 'Asset Bundles' started by Maeslezo, Jan 21, 2019.

  1. Maeslezo

    Maeslezo

    Joined:
    Jun 16, 2015
    Posts:
    81
    Summary:
    I have a scene in a bundle. The scene has a prefab. The prefab is in other bundle, with two variants.
    The scene always load the same prefab, regardless of the variant

    Does variants work with prefabs in scene?

    Additional Info
    The scene has four prefabs:
    Prefab 1: Variant a and b only differ in the texture. It works
    Prefab 2: Variant a and b only differ in the material. It works.
    Prefab 3: Variant a and b are totally different prefabs. It is loaded and instantiated in runtime. It works
    Prefab 4: Variant a and b are totally different prefabs. Prefab is in scene when the scene is loaded

    Thank you

    scene bundle.png
    variant bundle.png Result.png
     
  2. M_R

    M_R

    Joined:
    Apr 15, 2015
    Posts:
    347
    when you build, any prefab in the scene is unpacked ("baked" as plain gameObjects). prefabs don't exist at runtime.
    if you want variants (or just being in a different bundle), you need to instantiate dynamically
     
    Maeslezo likes this.
  3. Maeslezo

    Maeslezo

    Joined:
    Jun 16, 2015
    Posts:
    81
    Yes, that's the problem. Thank you.

    upload_2019-1-21_16-42-15.png