- Home /
What is the difference between a duplicate and a variant ?
When you make a prefab, you can either duplicate it, or make a variant - I am wondering if there is a difference between the two. I can't see a difference between them, and am wondering the uses for a variant if it is essentially the same thing as a duplicate.
If anyone knows the difference, I would love to know.
Answer by Hellium · Apr 02, 2019 at 07:32 AM
What is a "duplicate"? An exact copy of the prefab?
To explain what is a variant, let's take an example. You have an enemy prefab which is a simple box. The normal enemy is white, with a scale of (1,1,1). You have a prefab from it. Whenever you change something to the prefab and apply those changes, all the enemies are changed too.
Now, supposing you want a stronger enemy. You create a variant from the normal one. You set the scale to (1.2, 1.2, 1.2) and tint it in red. You can now spawn strong enemies along normal ones. If you change the color of the 2nd enemy (and apply those changes), all the strong enemies will change. If you decide to change the shape of the normal enemy, all the normal enemies AND the strong one will change.
Correct me if i'm wrong @Hellium, could what you're saying be that a prefab variant is the prefab analogue to class inheritance?
Your answer
Follow this Question
Related Questions
How should I structure this in Unity? 1 Answer
Possible Unity Glitch. A few lines of code erasing prefab data. 1 Answer
Does adding the same prefab to multiple objects duplicate the code? 1 Answer
How can you duplicate a prefab and sever all links to the original? 1 Answer
Instantiatied prefab runs script twice? 0 Answers