├── .gitignore ├── AlignTransform └── Editor │ ├── AlignTransform.cs │ └── AlignTransform.cs.meta ├── Img └── SceneFileManager.png ├── README.md ├── Renamer └── Editor │ └── Renamer.cs └── SceneFileManager ├── Editor.meta ├── Editor ├── Scene File Manager.meta └── Scene File Manager │ ├── SceneFileManager.cs │ ├── SceneFileManager.cs.meta │ ├── SceneFileManagerColors.cs │ ├── SceneFileManagerColors.cs.meta │ ├── SceneFileManagerData.cs │ └── SceneFileManagerData.cs.meta ├── Resources.meta └── Resources ├── SceneFileManagerColors.asset ├── SceneFileManagerColors.asset.meta ├── SceneFileManagerNames.asset └── SceneFileManagerNames.asset.meta /.gitignore: -------------------------------------------------------------------------------- 1 | # This .gitignore file should be placed at the root of your Unity project directory 2 | # 3 | # Get latest from https://github.com/github/gitignore/blob/main/Unity.gitignore 4 | # 5 | /[Ll]ibrary/ 6 | /[Tt]emp/ 7 | /[Oo]bj/ 8 | /[Bb]uild/ 9 | /[Bb]uilds/ 10 | /[Ll]ogs/ 11 | /[Uu]ser[Ss]ettings/ 12 | 13 | # MemoryCaptures can get excessive in size. 14 | # They also could contain extremely sensitive data 15 | /[Mm]emoryCaptures/ 16 | 17 | # Recordings can get excessive in size 18 | /[Rr]ecordings/ 19 | 20 | # Uncomment this line if you wish to ignore the asset store tools plugin 21 | # /[Aa]ssets/AssetStoreTools* 22 | 23 | # Autogenerated Jetbrains Rider plugin 24 | /[Aa]ssets/Plugins/Editor/JetBrains* 25 | 26 | # Visual Studio cache directory 27 | .vs/ 28 | 29 | # Gradle cache directory 30 | .gradle/ 31 | 32 | # Autogenerated VS/MD/Consulo solution and project files 33 | ExportedObj/ 34 | .consulo/ 35 | *.csproj 36 | *.unityproj 37 | *.sln 38 | *.suo 39 | *.tmp 40 | *.user 41 | *.userprefs 42 | *.pidb 43 | *.booproj 44 | *.svd 45 | *.pdb 46 | *.mdb 47 | *.opendb 48 | *.VC.db 49 | 50 | # Unity3D generated meta files 51 | *.pidb.meta 52 | *.pdb.meta 53 | *.mdb.meta 54 | 55 | # Unity3D generated file on crash reports 56 | sysinfo.txt 57 | 58 | # Builds 59 | *.apk 60 | *.aab 61 | *.unitypackage 62 | *.app 63 | 64 | # Crashlytics generated file 65 | crashlytics-build.properties 66 | 67 | # Packed Addressables 68 | /[Aa]ssets/[Aa]ddressable[Aa]ssets[Dd]ata/*/*.bin* 69 | 70 | # Temporary auto-generated Android Assets 71 | /[Aa]ssets/[Ss]treamingAssets/aa.meta 72 | /[Aa]ssets/[Ss]treamingAssets/aa/* 73 | -------------------------------------------------------------------------------- /AlignTransform/Editor/AlignTransform.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using UnityEditor; 3 | using UnityEngine; 4 | 5 | public class AlignTransform : MonoBehaviour 6 | { 7 | [MenuItem("Art Tools/Align Transform", false, 0)] 8 | static void PerformTransformAlign() 9 | { 10 | var selectedObjects = Selection.objects.OfType().ToArray(); 11 | var lastTf = selectedObjects.Last().transform; 12 | 13 | 14 | for (var i = 0; i < selectedObjects.Length - 1; i++) 15 | { 16 | var selectedObject = selectedObjects[i]; 17 | var currentTf = selectedObject.transform; 18 | Undo.RecordObject(currentTf, "Align transform " + currentTf.name + " with " + lastTf.name); 19 | currentTf.SetPositionAndRotation(lastTf.position, lastTf.rotation); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /AlignTransform/Editor/AlignTransform.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: deb683cb6ae18df4283161afc9df36cf 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Img/SceneFileManager.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Erfan-Sheikh/Unity_EditorUtils/a52a39f3b91b7d0e8c5c72c3b5fb13389ece7fee/Img/SceneFileManager.png -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Some Unity Editor Tools That i Use on daily Basis 2 | # Installation 3 | Downlaod the latest Unitypackage from the [Releases](https://github.com/Erfan-Sheikh/Unity_EditorUtils/releases) section. 4 | 5 | # Package Content 6 | ## Scene File Manager 7 | A handy little window to add your most used scene file in there and load them whithout the need to go through different folders each time. 8 | ![SceneFileManagerImage](Img/SceneFileManager.png) 9 | ## Batch Renamer 10 | An editor window inspired by c4d rename tool to batch rename files. 11 | 12 | 13 | 14 | https://github.com/Erfan-Sheikh/Unity_EditorUtils/assets/28543853/72c327cd-33df-4517-b717-3000b7285a29 15 | 16 | 17 | 18 | ## Align Transform 19 | Align the transform of the selected objects with the last selected object. 20 | 21 | 22 | 23 | https://github.com/Erfan-Sheikh/Unity_EditorUtils/assets/28543853/22734134-b3f3-4a60-a9cd-70177618a843 24 | 25 | -------------------------------------------------------------------------------- /Renamer/Editor/Renamer.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Sirenix.OdinInspector; 3 | using UnityEngine; 4 | using UnityEditor; 5 | 6 | public class Renamer : EditorWindow 7 | { 8 | private List objects; 9 | private string prefix = ""; 10 | private string suffix = ""; 11 | private string newName = ""; 12 | private string replacei = ""; 13 | private string replaceWith = ""; 14 | 15 | [MenuItem("Art Tools/Renamer")] 16 | static void CreateRenamer() 17 | { 18 | GetWindow(); 19 | } 20 | 21 | public void ChangeName() 22 | { 23 | var activeObjects = Selection.objects; 24 | var ID = 0; 25 | foreach (var activeObject in activeObjects) 26 | { 27 | var path = AssetDatabase.GetAssetPath(activeObject); 28 | 29 | AssetDatabase.RenameAsset(path, newName + ID); 30 | 31 | ID++; 32 | } 33 | } 34 | 35 | public void PrefixAndSuffix() 36 | { 37 | var activeObjects = Selection.objects; 38 | foreach (var activeObject in activeObjects) 39 | { 40 | var path = AssetDatabase.GetAssetPath(activeObject); 41 | var name = activeObject.name; 42 | AssetDatabase.RenameAsset(path, prefix + name + suffix); 43 | } 44 | } 45 | 46 | public void ReplaceWith() 47 | { 48 | if (replaceWith.Length <= 0 && replacei.Length <= 0) 49 | return; 50 | 51 | var activeObjects = Selection.objects; 52 | foreach (var activeObject in activeObjects) 53 | { 54 | var path = AssetDatabase.GetAssetPath(activeObject); 55 | var name = activeObject.name; 56 | name = name.Replace(replacei, replaceWith); 57 | 58 | AssetDatabase.RenameAsset(path, name); 59 | } 60 | } 61 | 62 | private void OnGUI() 63 | { 64 | newName = EditorGUILayout.TextField("New Name", newName); 65 | if (GUILayout.Button("Change Name")) 66 | { 67 | ChangeName(); 68 | newName = ""; 69 | Repaint(); 70 | } 71 | 72 | GUILayout.BeginHorizontal(); // Start a horizontal layout group 73 | prefix = EditorGUILayout.TextField("Prefix", prefix); 74 | suffix = EditorGUILayout.TextField("Suffix", suffix); 75 | GUILayout.EndHorizontal(); // End the horizontal layout group 76 | 77 | GUILayout.BeginHorizontal(); // Start a horizontal layout group 78 | replacei = EditorGUILayout.TextField("Replace", replacei); 79 | replaceWith = EditorGUILayout.TextField("With", replaceWith); 80 | GUILayout.EndHorizontal(); // End the horizontal layout group 81 | 82 | if (GUILayout.Button("Replace Names")) 83 | { 84 | PrefixAndSuffix(); 85 | ReplaceWith(); 86 | ClearNames(); 87 | Repaint(); 88 | } 89 | } 90 | 91 | private void ClearNames() 92 | { 93 | prefix = ""; 94 | suffix = ""; 95 | replacei = ""; 96 | replaceWith = ""; 97 | } 98 | } -------------------------------------------------------------------------------- /SceneFileManager/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 40a531492d7ce25439a05d5d1211eeb3 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /SceneFileManager/Editor/Scene File Manager.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d8a3fe49007ec58458e6284e28462c81 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /SceneFileManager/Editor/Scene File Manager/SceneFileManager.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEditor; 3 | using UnityEditor.SceneManagement; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.IO; 7 | using Random = UnityEngine.Random; 8 | 9 | public class SceneFileManager : EditorWindow 10 | { 11 | private Dictionary sceneFiles = new Dictionary(); 12 | private SceneFileManagerData m_sceneData; 13 | private SceneFileManagerColors colorsData; 14 | 15 | [UnityEditor.Callbacks.DidReloadScripts] 16 | private static void OnScriptsReloaded() 17 | { 18 | ShowWindow(); 19 | } 20 | 21 | [MenuItem("Window/Scene File Manager")] 22 | public static void ShowWindow() 23 | { 24 | SceneFileManager window = GetWindow("Scene File Manager"); 25 | window.LoadSceneFiles(); 26 | } 27 | 28 | private void LoadSceneFiles() 29 | { 30 | sceneFiles.Clear(); 31 | m_sceneData = Resources.Load("SceneFileManagerNames"); 32 | colorsData = Resources.Load("SceneFileManagerColors"); 33 | foreach (var sceneName in m_sceneData.sceneFilesNames) 34 | { 35 | Color color = m_sceneData.GetColorBySceneName(sceneName); 36 | Color.RGBToHSV(color, out float H, out float S, out float v); 37 | sceneFiles.Add(sceneName, Color.HSVToRGB(H, S, v)); 38 | } 39 | } 40 | 41 | private void OnGUI() 42 | { 43 | GUILayout.Label("Scene Files", EditorStyles.boldLabel); 44 | 45 | Event evt = Event.current; 46 | 47 | if (evt.type == EventType.DragUpdated) 48 | { 49 | DragAndDrop.visualMode = DragAndDropVisualMode.Copy; 50 | Event.current.Use(); 51 | } 52 | else if (evt.type == EventType.DragPerform) 53 | { 54 | DragAndDrop.AcceptDrag(); 55 | foreach (string draggedObject in DragAndDrop.paths) 56 | { 57 | if (draggedObject.EndsWith(".unity")) 58 | { 59 | string sceneName = Path.GetFileNameWithoutExtension(draggedObject); 60 | Color randomColor = PickRandomColorFromData(); 61 | Color.RGBToHSV(randomColor, out float H, out float S, out float v); 62 | m_sceneData.AddScene(sceneName, randomColor); 63 | sceneFiles.Add(sceneName, Color.HSVToRGB(H, S, v)); 64 | } 65 | } 66 | Event.current.Use(); 67 | } 68 | 69 | foreach (var scene in sceneFiles) 70 | { 71 | GUILayout.BeginHorizontal(); 72 | 73 | GUIStyle labelStyle = new GUIStyle(GUI.skin.label); 74 | labelStyle.normal.textColor = scene.Value; 75 | GUILayout.Label(scene.Key, labelStyle); 76 | 77 | if (GUILayout.Button("Load", GUILayout.Width(60))) 78 | { 79 | LoadScene(scene.Key); 80 | } 81 | 82 | if (GUILayout.Button("Remove", GUILayout.Width(80))) 83 | { 84 | sceneFiles.Remove(scene.Key); 85 | m_sceneData.RemoveScene(scene.Key); //TODO: change this so it won't use scene name as an identifier to delete a scene 86 | GUILayout.EndHorizontal(); 87 | break; 88 | } 89 | 90 | GUILayout.EndHorizontal(); 91 | } 92 | } 93 | 94 | private Color PickRandomColorFromData() 95 | { 96 | var colors = colorsData.sceneColors; 97 | var randomInt = Random.Range(0, colors.Count); 98 | return colors[randomInt]; 99 | } 100 | 101 | private void LoadScene(string sceneName) 102 | { 103 | string scenePath = FindScenePathByName(sceneName); 104 | if (!string.IsNullOrEmpty(scenePath)) 105 | { 106 | if (EditorSceneManager.SaveCurrentModifiedScenesIfUserWantsTo()) 107 | { 108 | EditorSceneManager.OpenScene(scenePath); 109 | } 110 | } 111 | } 112 | 113 | private string FindScenePathByName(string sceneName) 114 | { 115 | string[] guids = AssetDatabase.FindAssets("t:Scene"); 116 | foreach (string guid in guids) 117 | { 118 | string path = AssetDatabase.GUIDToAssetPath(guid); 119 | if (Path.GetFileNameWithoutExtension(path) == sceneName) 120 | { 121 | return path; 122 | } 123 | } 124 | return null; 125 | } 126 | } -------------------------------------------------------------------------------- /SceneFileManager/Editor/Scene File Manager/SceneFileManager.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9e51efaf988c8514a9630840e28918fb 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /SceneFileManager/Editor/Scene File Manager/SceneFileManagerColors.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System; 3 | using System.Collections.Generic; 4 | 5 | [CreateAssetMenu(fileName = "SceneFileManagerColors", menuName = "ErfanSh/SceneFileManager/Scene File Manager Colors")] 6 | public class SceneFileManagerColors : ScriptableObject 7 | { 8 | public List sceneColors; 9 | } -------------------------------------------------------------------------------- /SceneFileManager/Editor/Scene File Manager/SceneFileManagerColors.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8c010b9692cfaf1478306b45b12916df 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /SceneFileManager/Editor/Scene File Manager/SceneFileManagerData.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System; 3 | using System.Collections.Generic; 4 | using UnityEngine.Serialization; 5 | 6 | [CreateAssetMenu(fileName = "SceneFileManagerData", menuName = "ErfanSh/SceneFileManager/Scene File Manager Data")] 7 | public class SceneFileManagerData : ScriptableObject 8 | { 9 | public List sceneFilesNames; 10 | public List sceneFilesColors; 11 | 12 | public void AddScene(string mSceneName, Color mSceneColor) 13 | { 14 | sceneFilesNames.Add(mSceneName); 15 | sceneFilesColors.Add(mSceneColor); 16 | } 17 | 18 | public void RemoveScene(string mSceneName) 19 | { 20 | for (var i = 0; i < sceneFilesNames.Count; i++) 21 | { 22 | var sceneName = sceneFilesNames[i]; 23 | if (sceneName == mSceneName) 24 | { 25 | sceneFilesNames.Remove(sceneName); 26 | sceneFilesColors.Remove(sceneFilesColors[i]); 27 | return; 28 | } 29 | } 30 | } 31 | 32 | public Color GetColorBySceneName(string sceneName) 33 | { 34 | for (var i = 0; i < sceneFilesNames.Count; i++) 35 | { 36 | if (sceneFilesNames[i] == sceneName) 37 | { 38 | return sceneFilesColors[i]; 39 | } 40 | } 41 | 42 | return sceneFilesColors[0]; 43 | } 44 | } -------------------------------------------------------------------------------- /SceneFileManager/Editor/Scene File Manager/SceneFileManagerData.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c0a1965ada1eec848a4e8d98d4abb71e 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /SceneFileManager/Resources.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5ce109dd543e61b4eba0ea3705886032 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /SceneFileManager/Resources/SceneFileManagerColors.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: 8c010b9692cfaf1478306b45b12916df, type: 3} 13 | m_Name: SceneFileManagerColors 14 | m_EditorClassIdentifier: 15 | sceneColors: 16 | - {r: 0.10358262, g: 1, b: 0, a: 0} 17 | - {r: 1, g: 0, b: 0, a: 0} 18 | - {r: 0, g: 0.97067547, b: 1, a: 0} 19 | - {r: 1, g: 0, b: 0.9679408, a: 0} 20 | - {r: 1, g: 1, b: 1, a: 0} 21 | -------------------------------------------------------------------------------- /SceneFileManager/Resources/SceneFileManagerColors.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: af958a4de1b43884dac6e59c2a112d08 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 0 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /SceneFileManager/Resources/SceneFileManagerNames.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: c0a1965ada1eec848a4e8d98d4abb71e, type: 3} 13 | m_Name: SceneFileManagerNames 14 | m_EditorClassIdentifier: 15 | sceneFilesNames: 16 | - Multi-Language 17 | - Big Rich Text English 18 | - Big Rich Text Hebrew 19 | - Multiline 20 | sceneFilesColors: 21 | - {r: 1, g: 0, b: 0.8514986, a: 0} 22 | - {r: 0.77099997, g: 0, b: 0.6561061, a: 0} 23 | - {r: 0.587, g: 0, b: 0.49760923, a: 0} 24 | - {r: 0.447, g: 0, b: 0.37846005, a: 0} 25 | -------------------------------------------------------------------------------- /SceneFileManager/Resources/SceneFileManagerNames.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 08124e27b02e001478c4654566a61409 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 0 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | --------------------------------------------------------------------------------