For example, if I instantiate an object and then change the name of it in the hierarchy (ie changing Object.name) does this need to be removed in a production version?

If I wanted to remove " (clone)" from the name of an instantiated object this would require me to parse, split and reassign a string. It can make things much prettier when working in the editor but is completely unnecessary in a production build.

Do I have to remove this or will Unity recognize that changing the hierarchical name of an object is meaningless to the build and ignore it?

Your question is a bit confusing. However it seems that you used “Instantiate” in some sort of editor code, which you shouldn’t, at least when dealing with prefabs. To create a prefab instance during edit mode you should use the PrefabUtility: PrefabUtility.InstantiatePrefab. This will actually preserve the prefab connection.

Prefabs are a pure editor feature. At runtime there are just gameobjects. There are GameObjects serialized into a scene and there are GameObjects which aren’t in a scene (the former prefabs). Any change to properties on a gameobject instance in the scene is actually stored inside the scene itself.

At runtime you can’t even tell from which prefab a certain object came from. A scene is finally just composed of GameObjects, nothing more. The prefab itself isn’t even included in the build when you do not have an actual reference to it in a variable. So having instances of a prefab in a scene does not make the prefab being included in the build.

Prefabs are a pure organisatorical feature of the editor. Prefabs do not save any space in a scene. So having 100 duplicates of an object in the scene or having 100 prefab instances of the same object in a scene makes no difference. The objects are actually stored inside the scene.

So to answer your question: No, it makes no difference when you change the name of objects in the scene. Actually shortening the object names will actually save a few bytes of memory ^^

You don’t have to remove the name change from the final build. It will simply have no meaning outside of what you define it to be. This means, the compiler will not ignore it, it will simple be there like you did it in the editor. Unity doesn’t care about the object’s name, so if you don’t do anything with the name, other than cleaning up the hierarchy in the editor, you can wrap the name assignments in #if UNITY_EDITOR preprocessor statements, to get rid of them in the build.

Other than that, the title is a bit misleading, if my answer was the only part concerned. Beyond the name topic, there is no list of things Unity excludes by default, except all assets, which are not referenced by a scene, AssetBundle or were placed inside of the Resources folder. Script files are always included, except of course Editor scripts and code which is within #if UNITY_EDITOR or other statements, that are not true in release mode (like DEBUG). The Unity API doesn’t filter anything out automatically. The only special thing I can think of is the EditorOnly tag for GameObjects, which are automatically removed on build.