Search Unity

Why would you unpack a prefab instance?

Discussion in 'Editor & General Support' started by Tabbed, May 11, 2019.

  1. Tabbed

    Tabbed

    Joined:
    Nov 20, 2016
    Posts:
    9
    Context
    In my scene I have a few character that share the same prefab. Their prefab is the same and some of its components values are exactly the same, but some of their variables' values are different and sometimes random; such as hair color, skin color, etc.

    Instead of creating a new prefab for each new character, I simply put the prefab in the scene and modify its variables.

    It bothered me the fact that every variable I modify gets bolded, so I found out that UnpackingPrefabInstances fixes this "problem" I had.

    And then I started asking myself whether my way of doing things is good or not. Because I've never used that function before.

    Should I unpack my characters?

    When/why would you unpack a prefab instance?
     
  2. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    6,530
    The bolding is to tell you at a glance that the field is set to a different value than that of the original prefab. When you unpack your prefab instance you are effectively breaking its connection to the original prefab. This means any later changes you make to the prefab will not be reflected in these unpacked prefab instances.

    Whether that is good or bad depends on what you're trying to do.
     
  3. Tabbed

    Tabbed

    Joined:
    Nov 20, 2016
    Posts:
    9

    In what scenarios would you unpack it?

    Thanks for you reply.
     
  4. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    6,530
    If I planned on changing the prefab, but want a unique version of that prefab in a scene that doesn't get any of those changes. It is an unlikely scenario for something like an enemy or player prefab, since these would be things I'd want to instantiate instead of being scene objects.

    I would do it for something like a camera prefab, where maybe I want a security camera object I want to base on the main camera to start and then tweak, and don't want any later changes to the main camera prefab to modify the security camera.