Search Unity

Prefab with changable appearance

Discussion in 'Getting Started' started by minidmnv, Jan 11, 2019.

  1. minidmnv


    Jan 5, 2019
    Hey guys!

    I was trying to find answer for this question for about 2h now on, but no luck.

    I'm wondering what's the best approach to get (for example) hero in my MainScene which can have different initial variables values, and different appearance, I've came up with two ideas:
    First is to create a multiple prefab variants and just instantiate one based on variable passed from MainMenuScene(example, again).
    Second - I've not tested it yet - is to somehow pin multiple graphics to one game object and just render one, that should be visible, also pass multiple values which I can pass to game object instance then.

    Have You faced similar problem? What You can tell about that and which way should I choose based on Your experience?

    Thanks for Your replies!

  2. JoeStrout


    Jan 14, 2011
    I'm not sure I understand what you're asking. When you drag a prefab into a scene, you don't need to leave all its property values as they are in the prefab. You can change any variables (including materials) you like, and Unity will keep track of which ones you've changed, and which are using the standard prefab values.