Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice
  4. Dismiss Notice

Rename prefab via Inspector does not change name in Project [video]

Discussion in 'Editor & General Support' started by Pawl, Aug 30, 2016.

  1. Pawl

    Pawl

    Joined:
    Jun 23, 2013
    Posts:
    113
    When I try to rename a prefab (ie, "Foo" in the video below) from the Inspector, it does not change the name in the Project view. Is this something new with Unity 5?

    https://gfycat.com/WhisperedFabulousAssassinbug

    However, renaming the prefab from the Project view does update the name in the Inspector view.

    Restarting Unity did not fix the issue. This is a more or less default project with Unity 5.4.0f3.

    Thanks
     
  2. shawn

    shawn

    Unity Technologies

    Joined:
    Aug 4, 2007
    Posts:
    552
    Hey, this is actually expected behavior. Though definitely not obvious. Due to how Unity's asset database system and serialization system work, an object's name in memory does not necessarily match the name of a file (they are not coupled in any way). We do set the Prefab's name when renaming the asset in the project view, but currently not the other way around. Renaming assets is a pretty invasive operation, especially when considering version control systems. I'm beginning to think that we should disallow renaming the prefab in the inspector at all to help avoid confusion.
     
  3. Pawl

    Pawl

    Joined:
    Jun 23, 2013
    Posts:
    113
    Got it. I could be mistaken, but I believe this worked differently in Unity 4.x?

    We recently upgraded from 4.6 to 5.4 and I noticed this when attempting to rename the prefab (which I assume I've always done in the same way).

    Either way, thanks for the clarification shawn.
     
  4. Mochnant

    Mochnant

    Joined:
    Apr 23, 2015
    Posts:
    7
    It definitely worked differently in Unity 4.x, as I was just watching a tutorial video in 4.6 and they renamed the prefab in the inspector and it changed the name in the project view.
     
  5. RowanG1

    RowanG1

    Joined:
    Nov 17, 2017
    Posts:
    2
    Just save your project after changing the name of prefab, then the name updates.
     
  6. GXMark

    GXMark

    Joined:
    Oct 13, 2012
    Posts:
    500
    Removing the ability to rename prefabs ! Wouldn't that make organisation of a larger project filling up with prefab references much more difficult to edit and manage ?

    Any renames from the project inspector should rename all linked hierarchy prefabs but it doesn't. In my experience it leaves me with only some of the prefabs renamed even though if i press the select button it refers back correctly to the prefab in the project. Renaming from the hierarchy should only update the prefab instance.
     
    CloudyVR likes this.
  7. illinar

    illinar

    Joined:
    Apr 6, 2011
    Posts:
    857
    I'm running into this issue right now. This is very important for me to rename all my instances otherwise it's gonna be a mess!
     
  8. Patrick_PS

    Patrick_PS

    Joined:
    Sep 9, 2019
    Posts:
    142
    I have the same issue. As soon as I close and reopen the editor the prefab name is reverted.