Search Unity

What is the advantage to making a pre-fab variant rather than an original prefab?

Discussion in 'Prefabs' started by KiddUniverse, Oct 1, 2019.

  1. KiddUniverse

    KiddUniverse

    Joined:
    Oct 13, 2016
    Posts:
    115
    I get that with prefabs you can move them between projects, edit one and every instance of that prefab will be affected, and nest them so that if they're part of a different prefab that if you edit them those changes will be applied even to those prefabs that are nested, and I understand that you can override prefabs which, correct me if i'm wrong, means that you make a single specific instance of a variant of a prefab without applying those changes to the rest of the prefabs, but I don't understand why I would choose to make an actual "prefab variant" rather than an original prefab.

    whenever i'm making a prefab that is similar to another, i take the first prefab, drag it into the scene, change the name and whatever i need to adjust on it, and then drag it back into the project window to create a completely separate prefab, but i'm given the option of either considering it a 'variant' or an 'original.' can someone enlighten me on the benefits of each option? after reading the API on prefab variants, i'm still not seeing any reason to use variants rather than just calling it an original. there must be some benefit, right?
     
  2. It is kind of self explanatory. If you create two separate prefabs, then they will be separate but they will have a bunch of similar values. If you choose to create a variant, then you will have _the_same_ values but something is different (variant).

    Then you find out you want to change some values on all of your prefabs. If you have separate prefabs, then you need to do this one by one.
    If you have variants, you just change the original prefab, the variants which does not override the value you're changing will take up the new value automatically.

    In abstract terms:
    - prefab1, color: blue, material: textile
    - prefab1variant, color: green (override), material: textile (inherited)

    If you change the material: textile to material: stone, all of the variants which don't override the material: textile will switch to stone just like that.