I am using Unity on Ubuntu 16.04 and I can't rename objects or assets using the F2 key as I could when I was using Windows.
What is the shortcut on Linux then?
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It only takes a minute to sign up.
Sign up to join this communityI am using Unity on Ubuntu 16.04 and I can't rename objects or assets using the F2 key as I could when I was using Windows.
What is the shortcut on Linux then?
There's a way to just custom make what you need to do. Put the following code inside a script with the same name (doesn't have to be on a game object).
using UnityEngine;
using UnityEditor;
using System.Reflection;
public class MenuItemsExample
{
[MenuItem("Edit/Rename _F2")]
private static void Rename()
{
var type = typeof(EditorWindow).Assembly.GetType("UnityEditor.SceneHierarchyWindow");
var hierarchyWindow = EditorWindow.GetWindow(type);
var rename = type.GetMethod("RenameGO", BindingFlags.Instance | BindingFlags.NonPublic);
rename.Invoke(hierarchyWindow, null);
}
}
This will bind F2 to a rename functionality, using reflection. I've found this from the Unity forums (had to dig a bit but nothing too hard to find). The name part is mine, that's what binds F2 to the function and there's also a nice menu item that appears in your edit menu. Here's a GIF that shows the functionality (shouldn't be dependent on the OS):
Here's the link to the forum post.