- Home /
Prefab variant changing all other variants.
So I have prefab variants A, B, C off of the main prefab UI, and each are for a different scene. In each scene the variants are nested in the MainCamera prefab. When I change A and apply the changes to the MainCamera prefab, it also changes B, and C, but B and C are kept as separate variants. How do I have a variant not change other variants when nested in another prefab?
Answer by Xavier78 · May 02, 2019 at 01:15 AM
Sometimes it is just best to write it out and then figure out the answer 1 minute later. Hope this helps someone else also.
Problems
Okay new solution that works. but first a bit more about the problem.
problem 1: The actual problem that was happening was the name of the nested prefab variant stayed the same, but the actually prefab variant changed. Thus making me think it was applying to all.
problem 2: You can't have different nested prefab variants for one prefab, as if you apply it will change it for all the instances of the prefab.
problem 3: If you then try to make the a variant of the base prefab(MainCamera), and then switch out the nested variants there(A,B,C) you will be stuck with two of the objects, as MainCamera has one, and then the variant of MainCamera will have to have the base nested variant, and the new nested variant you are trying to add.
Solution
Don't have a nested variant in the base prefab(MainCamera), but then for each variant of MainCamera have a nested variant prefab there. Each variant then will have any changes to MainCamera, but will not effect the nested variants. Just note you will have to copy the nest variant in, as if you try to directly add it to the base variant the prefab editor(which need improvements, come on unity) will try to force you to add it to the original base prefab, and not allow you to add it to the base variant.