Editor tool: Quick script opener

Quick info

Engine: Unity3D,
Programming language: C#,
Platform: Pc,
Role: Developer,
Team size: 1
Date: December 2018

About the tool

This tool is made to open your most used or favored script quick and easy without looking through your project folder structure.
By press the big button you’ll open the script in your engine assigned IDE or you can select the script in your project folder with clicking the (S)elect button.

Main features:

Save your scripts
The user can customize what scripts are shown in the inspector by adding scripts in the favorite window.

Customize your layout
The user can fully change the window layout by changing it in the settings menu.

Different file extenstion support
This tool support the following file extensions:
.cs
.shaders
.json

File searching
The user can search type in the search bar File:<function name> and the tool shows the script that contains that object that you searched for.
The user can also search for variables and other code snippets the same way as shown above.
And of course can the user also just search their scripts in the search bar.

Code snippet: GetScriptNameFromPath in Manager.cs

Those functions are basic functionality in the manager for saving data and getting file names.


Small update from the future about the bottom function. I’ve learned that you can use:
string _path = yourFilePath.GetFileNameWithoutExtension(fileName);
to get the filename without the extension

source for GetFileNameWithoutExtension


to get the filename without the extension

		/// <summary>
		/// writes the para data to json to local directory
		/// </summary>
		/// <param name="_savedScripts">all scripts data</param>
		public static void SaveScripts(ScriptsData _savedScripts)
		{
			UpdateFolderStructure();
			string _json = ToJson(_savedScripts);

			File.WriteAllText(m_savedScriptsPath, "");
			File.WriteAllText(m_savedScriptsPath, _json);
		}

		/// <summary>
		/// saves all settingsdata to json
		/// </summary>
		/// <param name="_data"></param>
		public static void SaveSettings(SettingsData _data)
		{
			UpdateFolderStructure();

			string _settingsJson = ToJson(_data);
			File.WriteAllText(m_SavedSettingsPath, _settingsJson);
		}		

		/// <summary>
        /// returns file name based on settings
        /// </summary>
        /// <param name="_path">full path where to get the name from</param>
        /// <param name="_removeExtension">bool:remove .cs or .shader etc?</param>
        /// <param name="_fileType">enum what filetype it is so it knows what to remove if you want to remove the extention</param>
        /// <returns></returns>
        public static string GetScriptNameFromPath(string _path, bool _removeExtension, FileType _fileType)
		{
			string[] _pathSplitted = _path.Split('/');
			string _fullName = _pathSplitted[_pathSplitted.Length - 1];

			if (_removeExtension)
			{
				int _extLength = _fileType.ToString().Length + 1;
				string _fullNameNoExt = _fullName.Remove(_fullName.Length - _extLength, _extLength);
				return _fullNameNoExt;
			}
			return _fullName;
		}