Search Unity

Replacing GameObject with Another one WITHOUT losing its components

Discussion in 'Prefabs' started by msaiduraz, Jun 19, 2020.

  1. msaiduraz

    msaiduraz

    Joined:
    Dec 19, 2019
    Posts:
    1
    Hi everyone,
    I couldn't find my question's answer. If there is one, sorry for that. But first let me explain.
    I have 2 different 2D characters. I have used the 1st one and worked on it couple weeks. But then i've changed my mind and i wanted to use 2nd character. Can i replace the 1st one with the 2nd one without losing all the components (like rigidbody2d, collider, scripts etc.) I just want to change its visual. A different sprite but with same properties.
    Thanks in advance
     
  2. matteotallevi

    matteotallevi

    Joined:
    Aug 14, 2018
    Posts:
    2
    You can create a Prefab Variant fo your original character and then change only the parameters you want to change in the new variant
     
  3. koirat

    koirat

    Joined:
    Jul 7, 2012
    Posts:
    2,073
    Just remember that prefab variants are very risky since you have to plan many things upfront, and you will not be able to change inheritance chain later.