Breaking a prefab

I’ve noticed the option to break a prefab is no longer present under GameObject. Is ‘Unpack Prefab’ and ‘Unpack Prefab Completely’ the equivalent? Also, if I break/unpack a prefab, how can I change some of the properties, such as the colour, without it affecting all the others in the scene?

The prefab workflow changed in 2018.3. Unpack Prefab is sort of the equivalent of break prefab. Prefabs can now be nested, so Unpack Prefab only unpacks that one prefab. Unpack Prefab Completely will also unpack any child prefabs as well. You can do overrides for component parameters for prefab instances in your scene without applying those overrides to the prefab itself, without unpacking - similar to how you could do the same thing in the old prefab workflow by just not hitting the apply button.

1 Like

I’m sorry, but I’m still not sure how. Even if I (completely) unpack an instance of a prefab, or enter the prefab, and adjust the colour, it does the same thing to all the others as well.

I still haven’t figured out how to adjust a prefab that doesn’t affect all the others. If I unpack one completely and then change the colour, it’s still affecting all the others. :-\

No one…? :frowning:

It sounds like you’re opening the prefab?

Yeah, don’t do that. Select the prefab in the scene or hierarchy and edit it like a normal GameObject. Shouldn’t even need to Unpack/Completely for that to work.

Apologies, though, if I’ve misinterpreted that post.

That doesn’t work though. My prefab is a platform that’s made of two small ones joined together under a parent object. I can only change the colour of the small ones, but if I do that all of my others in the scene change colour. :-\

To rephrase: are you opening the prefabs, or editing the instances directly without opening them?

Yeah, I’m opening them. Which you said not to. I think I may have set them up wrong… As I say, I have two smaller platforms, which are under a parent object. But whether I open them or select them from the hierarchy to access their components, the same thing happens - changing the colour of one changes them all. :-/

…Huh. It should be possible to just unfold the prefab and edit the child objects in the scene, without opening them or the prefab (just to distinguish unfolding and opening–two separate things!). Is there something preventing that from happening?

Oh, also: are you using the arrow on the left? Because that’s the correct one to be using, and will unfold the object. The one on the right will do the same thing as pressing “Open” at the top of the inspector.

Sorry if I’m retreading information you already know here. I know I probably can’t do better, but it still feels really impolite somehow :face_with_spiral_eyes:

No, I can unfold and edit the child objects without opening the prefabs, it’s just that no matter which way I do it, changing something of one changes all of them. Even if I make a new prefab from my imported model, and put two or three together, the same thing happens - change the colour and they’re all affected. :frowning:

Ah. Okay. Just occurred to me: I’ve been assuming your graphics were 2D, but looking at the screenshot you posted above, it appears that they’re 3D. That changes things.

To set the color of an object, you have to set the color on the material, right? But materials aren’t part of GameObjects/Prefabs–they’re separate assets, and thus the G.O./Prefab doesn’t keep track of their parameters, even though the material editor is shown at the bottom of the G.O. inspector. (Very convenient in many cases, but…evidently also misleading.)

In order to set a specific platform up as a different color, make a copy of the regular platform material and assign it to the different platform. (Also rename it–your future self will be cursing you otherwise.) Then you can change the color of the copy, and only the platform(s) with the copied material will change accordingly. Again, no unpack necessary.

Technically speaking, there’s another way to change the color of only one specific object, that being MaterialPropertyBlock. But that method requires scripting to implement, gets inefficient when you’re dealing with more than one or two different objects, and is generally just not worth the trouble in most 3D cases.

1 Like

Ahh, gotcha. Thanks. That’s done the trick. :smile:

1 Like