Unity3D: In the project window, press alt to display the file suffix. In the unity3d window
When the unity layout is 2By3 or other la s, it is not convenient to view the file suffix and press alt to import the following script to the project.
Using UnityEngine; using UnityEditor; using System. IO; using System. reflection; // on the project page, press alt to display the file extension [InitializeOnLoad] public static class ShowFileExtensions {// ==================== ========================================================== ==================================/// static constructor // using static ShowFileExtensions () {EditorApplication. projec Tsung witemongui + = projectsung witemongui ;} // ================================================ ========================================================== ==// checking editor events // ---------------------------------------------------------------------------------- private static void project=witemongui (string guid, rect rect) {if (Event. current. alt) {// EditorWindow window = GetProjectWindow (); string assetPath = Ass EtDatabase. GUIDToAssetPath (guid); UnityEngine. Object obj = AssetDatabase. LoadAssetAtPath <UnityEngine. Object> (assetPath); if (obj! = Null & AssetDatabase. IsMainAsset (obj )&&! IsDirectory (obj) {if (showsBigIcons) {// just draw it bold in upper left string extension = Path. getExtension (assetPath); GUI. label (rect, extension, EditorStyles. boldLabel);} else {// we overpaint the filename here, does look a bit dirty and might need adjustment of the offset var labelRect = rect. translate (new Vector2 (19f, 1f); var fileName = Path. getFileName (assetPath); GUI. label (labelRect, FileName) ;}} EditorApplication. repaintProjectWindow ();}} // ================================================ ========================================================== ==// getting infos about the project window // specify private static bool showsBigIcons {get {return isTwoColumnMode & listare1_dsize> 16f ;}} private static bool isTwoColumnM Ode {get {var projectWindow = GetProjectWindow (); var projectWindowType = projectWindow. getType (); var modeFieldInfo = projectWindowType. getField ("m_ViewMode", BindingFlags. instance | BindingFlags. nonPublic); int mode = (int) modeFieldInfo. getValue (projectWindow); // 0 = ViewMode. oneColumn // 1 = ViewMode. twoColum return mode = 1 ;}} private static float listare1_dsize {get {var projectWi Ndow = GetProjectWindow (); var projectWindowType = projectWindow. getType (); var propertyInfo = projectWindowType. getProperty ("listare1_dsize", BindingFlags. instance | BindingFlags. public); return (float) propertyInfo. getValue (projectWindow, null );}} /// <summary> // there's a chance here we get the wrong one when two project windows are open /// </summary> private static EditorWindow GetProjec TWindow () {if (EditorWindow. focusedWindow! = Null & EditorWindow. focusedWindow. titleContent. text = "Project") {return EditorWindow. focusedWindow;} return GetExistingWindowByName ("Project");} private static EditorWindow GetExistingWindowByName (string name) {EditorWindow [] windows = Resources. findObjectsOfTypeAll <EditorWindow> (); foreach (var item in windows) {if (item. titleContent. text = name) {return item;} return default (Editor Window );} // ================================================ ========================================================== ==// utilities // ------------------------------------------------------------------------------------ private static Rect Translate (this Rect rect, vector2 delta) {rect. x + = delta. x; rect. y + = delta. y; return rect;} private static bool IsDirectory (UnityEngine. object obj) {if (obj = null) {return false ;} Return obj is DefaultAsset &&! AssetDatabase. IsForeignAsset (obj );}}