Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between prefab(original) and variant prefab?

Tags:

unity3d

I have a door I created with some colors shader and more. When I dragged the door some time ago and it asked me what to do I selected variant. But now I decided to select to create original prefab and the door colors or maybe it's the shader become pink.

This is a screenshot of the prefabs the original and the variant in the Assets. The one in pink is the original the one in red and it should be in red is the variant.

What is the difference between prefab(original) and variant prefab and why it's changing the color to pink when making original ?

What should I choose ? Original or variant ?

Prefabs

And a screenshot of the door in the scene view window before dragging it to the Assets :

Door

like image 217
Daniel Lip Avatar asked Oct 09 '19 08:10

Daniel Lip


People also ask

What is prefab and what is the relationship between prefab and instance?

A prefab is an asset type that allows you to store a GameObject complete with components and properties. This allows us to share pre-configured hierarchies of objects between scenes. The prefab acts as a template from which you can create new object instances in the scene in the Editor and at runtime.

What is the purpose of a prefab?

Prefabs are a special type of component that allows fully configured GameObjects to be saved in the Project for reuse. These assets can then be shared between scenes, or even other projects without having to be configured again. This is quite useful for objects that will be used many times, such as platforms.

How can you tell if an object is a prefab?

To check if an object is part of Prefab contents in Prefab Mode, use PrefabStage. IsPartOfPrefabContents.


1 Answers

Just like you have a regular prefab in order to have a predefined object, you have prefab variants which is just another level. It represents the need to have different predefined versions of the prefab itself. Prefab variants are usefull when you don't want to override the base prefab, but you want to use the overrided one multiple times, so you make a prefab variant.

https://www.youtube.com/watch?v=ibmdm_PoyMA

So basically when you have a prefab instance and you make changes to it, you can either override the original prefab (losing its original state), or you make a prefab variant and then you can have both of them as prefabs.

like image 175
Milos Romanic Avatar answered Nov 15 '22 11:11

Milos Romanic