The rename prompt is super annoying - I think I have a fix

Because we have the custom edit-time renamer, it plays havoc with the Unity Editor. One very annoying issue is that every time you try editing the Tile prefab, you get a prompt to rename the file.

I was thinking if there was a way around it, and I figured - why don’t I turn off the renaming when we’re editing the Prefab? As it turns out, it is pretty simple (per this thread):

            if (PrefabStageUtility.GetCurrentPrefabStage() == null)
            {
                // Only update the object name if we are not editing the prefab
                UpdateObjectName();
            }

And voila, renaming while moving tiles still works, but when editing the prefab, all is good!

1 Like

Perfect! Adding in a:

using UnityEditor.Experimental.SceneManagement;

This works great! Apparently (according to the thread you linked) there’s a non “experimental” way to do this in later versions now. But I’m using 2020.3.36f1 and this still works. Thanks!

Privacy & Terms