Search Unity

Re-naming a prefab

Discussion in 'Prefabs' started by HamFar, Jan 15, 2019.

  1. HamFar

    HamFar

    Joined:
    Nov 16, 2014
    Posts:
    89
    How can I re-name a prefab that is used in several scenes with many dependencies without breaking anything?

    Is it as simple as re-naming a game object or is there a way of making sure the links between it and its dependencies are not broken?

    I am using Unity version 2018.2.17f1
     
  2. JesOb

    JesOb

    Joined:
    Sep 3, 2012
    Posts:
    1,109
    You can rename prefab in eny way anytime you like.
    Unity store links to any asset through asset GUIDs so name of prefab just not used by Unity itself.

    Just be sure you rename prefab inside Unity or rename coresponding *.meta file too.
     
    HamFar likes this.
  3. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,791
    You should be a bit careful though if you also use Collaborate. Renaming and moving files around can cause issues with it.
     
    HamFar likes this.
  4. JesOb

    JesOb

    Joined:
    Sep 3, 2012
    Posts:
    1,109
    Good point.

    I dont use collaborate and dont have such issues.
    May be some one need to fire a bug to Unity that Collaborate dont support some core Unity features :)
     
    HamFar likes this.
  5. HamFar

    HamFar

    Joined:
    Nov 16, 2014
    Posts:
    89
    @Jes28 Thank you. I will re-name it within the Unity Editor. Would it make a difference if I re-named the actual prefab itself (which is inside the Prefabs folder) or if I re-named the game object in the Hierarchy that is the latest and up-to-date instantiation of the prefab?
     
  6. JesOb

    JesOb

    Joined:
    Sep 3, 2012
    Posts:
    1,109
    To say short Yes.

    Game object is not prefab, it is instance of prefab so you can rename it as you wish but this is not make any changes to prefab itself. And not break anything.

    Scene prefab instance just keeps reference to prefab itself using prefab id and additionally stores all property override that you do on instance.

    Base Unity concept is that you can rename anything because all links stored through asset guids.
     
    HamFar likes this.