├── .gitignore ├── Assets ├── Cleaner.meta └── Cleaner │ ├── Editor.meta │ └── Editor │ ├── AssetCollector.cs │ ├── AssetCollector.cs.meta │ ├── AssetReferenceCollection.cs │ ├── AssetReferenceCollection.cs.meta │ ├── ClassReferenceCollection.cs │ ├── ClassReferenceCollection.cs.meta │ ├── CollectionData.cs │ ├── CollectionData.cs.meta │ ├── FindUnusedAssetsWindow.cs │ ├── FindUnusedAssetsWindow.cs.meta │ ├── ShaderReferenceCollection.cs │ └── ShaderReferenceCollection.cs.meta ├── LICENSE ├── ProjectSettings ├── AudioManager.asset ├── ClusterInputManager.asset ├── DynamicsManager.asset ├── EditorBuildSettings.asset ├── EditorSettings.asset ├── GraphicsSettings.asset ├── InputManager.asset ├── NavMeshAreas.asset ├── NetworkManager.asset ├── Physics2DSettings.asset ├── ProjectSettings.asset ├── ProjectVersion.txt ├── QualitySettings.asset ├── TagManager.asset ├── TimeManager.asset ├── UnityAdsSettings.asset └── UnityConnectSettings.asset ├── README.md └── cleaner.unitypackage /.gitignore: -------------------------------------------------------------------------------- 1 | [Ll]ibrary/ 2 | [Tt]emp/ 3 | [Oo]bj/ 4 | [Bb]uild/ 5 | 6 | # Autogenerated VS/MD solution and project files 7 | *.csproj 8 | *.unityproj 9 | *.sln 10 | *.suo 11 | *.tmp 12 | *.user 13 | *.userprefs 14 | *.pidb 15 | *.booproj 16 | 17 | # Unity3D generated meta files 18 | *.pidb.meta 19 | 20 | # Unity3D Generated File On Crash Reports 21 | sysinfo.txt 22 | BackupUnusedAssets 23 | Assets/AssetFiles 24 | Assets/AssetFiles.meta 25 | -------------------------------------------------------------------------------- /Assets/Cleaner.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 560c1e0b442b441c898a2c50e18ef593 3 | folderAsset: yes 4 | timeCreated: 1439880050 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Cleaner/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 046eee13f4d85b34fa74fbcf9fe8448f 3 | folderAsset: yes 4 | timeCreated: 1440813537 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Cleaner/Editor/AssetCollector.cs: -------------------------------------------------------------------------------- 1 | /** 2 | asset cleaner 3 | Copyright (c) 2015 Tatsuhiko Yamamura 4 | 5 | This software is released under the MIT License. 6 | http://opensource.org/licenses/mit-license.php 7 | */ 8 | using UnityEngine; 9 | using System.Collections; 10 | using System.Collections.Generic; 11 | using System.Linq; 12 | using UnityEditor; 13 | using System.IO; 14 | using System.Text.RegularExpressions; 15 | using System.Text; 16 | using System.Runtime.Serialization.Formatters.Binary; 17 | using System.Xml.Serialization; 18 | 19 | namespace AssetClean 20 | { 21 | public class AssetCollector 22 | { 23 | public static readonly string exportXMLPath = "referencemap.xml"; 24 | 25 | public List deleteFileList = new List (); 26 | List referenceCollection = new List (); 27 | 28 | public bool useCodeStrip = true; 29 | public bool saveEditorExtensions = true; 30 | 31 | public void Collection (string[] collectionFolders) 32 | { 33 | 34 | try { 35 | XmlSerializer serialize = new XmlSerializer (typeof(List)); 36 | deleteFileList.Clear (); 37 | referenceCollection.Clear (); 38 | 39 | if (File.Exists (exportXMLPath)) { 40 | using (var fileStream = new StreamReader (exportXMLPath)) { 41 | referenceCollection = (List)serialize.Deserialize (fileStream); 42 | fileStream.Close (); 43 | } 44 | } 45 | 46 | List collectionList = new List (); 47 | 48 | if (useCodeStrip) { 49 | collectionList.Add (new ClassReferenceCollection (saveEditorExtensions)); 50 | } 51 | 52 | collectionList.AddRange (new IReferenceCollection[] { 53 | new ShaderReferenceCollection (), 54 | new AssetReferenceCollection (), 55 | }); 56 | 57 | foreach (var collection in collectionList) { 58 | collection.Init (referenceCollection); 59 | collection.CollectionFiles (); 60 | } 61 | 62 | // Find assets 63 | var files = StripTargetPathsAll (useCodeStrip, collectionFolders); 64 | 65 | foreach (var path in files) { 66 | var guid = AssetDatabase.AssetPathToGUID (path); 67 | deleteFileList.Add (guid); 68 | } 69 | EditorUtility.DisplayProgressBar ("checking", "collection all files", 0.2f); 70 | UnregistReferenceFromResources (); 71 | 72 | EditorUtility.DisplayProgressBar ("checking", "check reference from resources", 0.4f); 73 | UnregistReferenceFromScenes (); 74 | 75 | EditorUtility.DisplayProgressBar ("checking", "check reference from scenes", 0.6f); 76 | if (saveEditorExtensions) { 77 | UnregistEditorCodes (); 78 | } 79 | 80 | EditorUtility.DisplayProgressBar ("checking", "check reference from ignorelist", 0.8f); 81 | UnregistReferenceFromIgnoreList (); 82 | UnregistReferenceFromExtensionMethod (); 83 | 84 | using (var fileStream = new StreamWriter (exportXMLPath)) { 85 | serialize.Serialize (fileStream, referenceCollection); 86 | fileStream.Close (); 87 | } 88 | 89 | } finally { 90 | EditorUtility.ClearProgressBar (); 91 | } 92 | } 93 | 94 | List StripTargetPathsAll (bool isUseCodeStrip, string[] pathes) 95 | { 96 | var files = pathes.SelectMany (c => Directory.GetFiles (c, "*.*", SearchOption.AllDirectories)) 97 | .Distinct () 98 | .Where (item => Path.GetExtension (item) != ".meta") 99 | .Where (item => Path.GetExtension (item) != ".js") 100 | .Where (item => Path.GetExtension (item) != ".dll") 101 | .Where (item => Regex.IsMatch (item, "[\\/\\\\]Gizmos[\\/\\\\]") == false) 102 | .Where (item => Regex.IsMatch (item, "[\\/\\\\]Plugins[\\/\\\\]Android[\\/\\\\]") == false) 103 | .Where (item => Regex.IsMatch (item, "[\\/\\\\]Plugins[\\/\\\\]iOS[\\/\\\\]") == false) 104 | .Where (item => Regex.IsMatch (item, "[\\/\\\\]Resources[\\/\\\\]") == false); 105 | 106 | if (isUseCodeStrip == false) { 107 | files = files.Where (item => Path.GetExtension (item) != ".cs"); 108 | } 109 | 110 | return files.ToList (); 111 | } 112 | 113 | void UnregistReferenceFromIgnoreList () 114 | { 115 | var codePaths = deleteFileList.Where (fileName => Path.GetExtension (fileName) == ".cs"); 116 | 117 | foreach (var path in codePaths) { 118 | var code = ClassReferenceCollection.StripComment (File.ReadAllText (path)); 119 | if (Regex.IsMatch (code, "static\\s*(partial)*\\s*class")) { 120 | UnregistFromDelteList (AssetDatabase.AssetPathToGUID (path)); 121 | continue; 122 | } 123 | } 124 | } 125 | 126 | void UnregistReferenceFromExtensionMethod () 127 | { 128 | var resourcesFiles = deleteFileList 129 | .Where (item => Path.GetExtension (item) != ".meta") 130 | .ToArray (); 131 | foreach (var path in AssetDatabase.GetDependencies (resourcesFiles)) { 132 | UnregistFromDelteList (AssetDatabase.AssetPathToGUID (path)); 133 | } 134 | } 135 | 136 | void UnregistReferenceFromResources () 137 | { 138 | var resourcesFiles = deleteFileList 139 | .Where (item => Regex.IsMatch (item, "[\\/\\\\]Resources[\\/\\\\]") == true) 140 | .Where (item => Path.GetExtension (item) != ".meta") 141 | .ToArray (); 142 | foreach (var path in AssetDatabase.GetDependencies (resourcesFiles)) { 143 | 144 | UnregistFromDelteList (AssetDatabase.AssetPathToGUID (path)); 145 | } 146 | } 147 | 148 | void UnregistReferenceFromScenes () 149 | { 150 | // Exclude objects that reference from scenes. 151 | var scenes = EditorBuildSettings.scenes 152 | .Where (item => item.enabled == true) 153 | .Select (item => item.path) 154 | .ToArray (); 155 | foreach (var path in AssetDatabase.GetDependencies (scenes)) { 156 | 157 | UnregistFromDelteList (AssetDatabase.AssetPathToGUID (path)); 158 | } 159 | } 160 | 161 | void UnregistEditorCodes () 162 | { 163 | // Exclude objects that reference from Editor API 164 | var editorcodes = Directory.GetFiles ("Assets", "*.*", SearchOption.AllDirectories) 165 | .Where (fileName => Path.GetExtension (fileName) == ".cs") 166 | .Where (item => Regex.IsMatch (item, "[\\/\\\\]Editor[\\/\\\\]") == true) 167 | .ToArray (); 168 | 169 | EditorUtility.DisplayProgressBar ("checking", "check reference from editor codes", 0.8f); 170 | 171 | foreach (var path in editorcodes) { 172 | var code = ClassReferenceCollection.StripComment (File.ReadAllText (path)); 173 | if (Regex.IsMatch (code, "(\\[MenuItem|AssetPostprocessor|EditorWindow)")) { 174 | UnregistFromDelteList (AssetDatabase.AssetPathToGUID (path)); 175 | continue; 176 | } 177 | } 178 | foreach (var path in editorcodes) { 179 | var guid = AssetDatabase.AssetPathToGUID (path); 180 | 181 | if (referenceCollection.Exists (c => c.fileGuid == guid) == false) { 182 | continue; 183 | } 184 | 185 | var referenceGuids = referenceCollection.First (c => c.fileGuid == guid).referenceGids; 186 | 187 | 188 | 189 | if (referenceGuids.Any (c => deleteFileList.Contains (c) == true) == false) { 190 | UnregistFromDelteList (AssetDatabase.AssetPathToGUID (path)); 191 | } 192 | } 193 | } 194 | 195 | void UnregistFromDelteList (string guid) 196 | { 197 | if (deleteFileList.Contains (guid) == false) { 198 | return; 199 | } 200 | deleteFileList.Remove (guid); 201 | 202 | if (referenceCollection.Exists (c => c.fileGuid == guid)) { 203 | var refInfo = referenceCollection.First (c => c.fileGuid == guid); 204 | foreach (var referenceGuid in refInfo.referenceGids) { 205 | UnregistFromDelteList (referenceGuid); 206 | } 207 | } 208 | 209 | } 210 | } 211 | } 212 | -------------------------------------------------------------------------------- /Assets/Cleaner/Editor/AssetCollector.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 842f43ac94b4b4f72ac0898650ddcc44 3 | labels: 4 | - ActionGame 5 | timeCreated: 1437724265 6 | licenseType: Pro 7 | MonoImporter: 8 | serializedVersion: 2 9 | defaultReferences: [] 10 | executionOrder: 0 11 | icon: {instanceID: 0} 12 | userData: 13 | assetBundleName: 14 | assetBundleVariant: 15 | -------------------------------------------------------------------------------- /Assets/Cleaner/Editor/AssetReferenceCollection.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using System.IO; 5 | using UnityEditor; 6 | using System.Linq; 7 | 8 | public class AssetReferenceCollection : IReferenceCollection 9 | { 10 | public void Init( List refs ){ 11 | references = refs; 12 | } 13 | 14 | private List references = null; 15 | 16 | public void CollectionFiles () 17 | { 18 | var allFiles = Directory.GetFiles("Assets", "*.*", SearchOption.AllDirectories) 19 | .Where(c=> Path.GetExtension(c) != ".meta") 20 | .Where(c=> Path.GetExtension(c) != ".shader") 21 | .Where(c=> Path.GetExtension(c) != ".cg") 22 | .Where(c=> Path.GetExtension(c) != ".cginc") 23 | .Where(c=> Path.GetExtension(c) != ".cs"); 24 | 25 | foreach( var file in allFiles ){ 26 | CollectionReferenceAssets(file); 27 | } 28 | } 29 | 30 | public void CollectionReferenceAssets(string path) 31 | { 32 | var guid = AssetDatabase.AssetPathToGUID(path); 33 | if( File.Exists(path) == false ){ 34 | return; 35 | } 36 | 37 | var referenceFiles = AssetDatabase.GetDependencies(new string[]{path}); 38 | List referenceList = null; 39 | CollectionData reference = null; 40 | 41 | if( references.Exists(c=>c.fileGuid == guid) == false ) { 42 | referenceList = new List(); 43 | reference = new CollectionData() { 44 | fileGuid = guid, 45 | referenceGids = referenceList, 46 | }; 47 | references.Add(reference); 48 | }else{ 49 | reference = references.Find(c=>c.fileGuid == guid); 50 | referenceList = reference.referenceGids; 51 | } 52 | if( string.IsNullOrEmpty( AssetDatabase.GUIDToAssetPath(guid) ) == false ){ 53 | reference.timeStamp = File.GetLastWriteTime(AssetDatabase.GUIDToAssetPath(guid)); 54 | } 55 | 56 | foreach( var file in referenceFiles){ 57 | if( referenceList.Contains(file) == false ) 58 | referenceList.Add( AssetDatabase.AssetPathToGUID(file) ); 59 | } 60 | } 61 | 62 | } 63 | -------------------------------------------------------------------------------- /Assets/Cleaner/Editor/AssetReferenceCollection.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 805140a4856714e288ea84985d3023df 3 | labels: 4 | - ActionGame 5 | timeCreated: 1438701927 6 | licenseType: Pro 7 | MonoImporter: 8 | serializedVersion: 2 9 | defaultReferences: [] 10 | executionOrder: 0 11 | icon: {instanceID: 0} 12 | userData: 13 | assetBundleName: 14 | assetBundleVariant: 15 | -------------------------------------------------------------------------------- /Assets/Cleaner/Editor/ClassReferenceCollection.cs: -------------------------------------------------------------------------------- 1 | /** 2 | asset cleaner 3 | Copyright (c) 2015 Tatsuhiko Yamamura 4 | 5 | This software is released under the MIT License. 6 | http://opensource.org/licenses/mit-license.php 7 | */ 8 | using UnityEngine; 9 | using System.Collections; 10 | using System.Collections.Generic; 11 | using System.Text.RegularExpressions; 12 | using UnityEditor; 13 | using System.IO; 14 | using System.Reflection; 15 | using System.Linq; 16 | using System.Xml.Serialization; 17 | 18 | namespace AssetClean 19 | { 20 | public class ClassReferenceCollection : IReferenceCollection 21 | { 22 | // guid : types 23 | private List references = null; 24 | 25 | // type : guid 26 | private Dictionary> code2FileDic = new Dictionary> (); 27 | private List fileTypeList = null; 28 | public static readonly string xmlPath = "referenceType2File.xml"; 29 | 30 | private List fileTypeXML { 31 | get { 32 | if (File.Exists (xmlPath) == true) { 33 | using (var reader = new StreamReader(xmlPath)) { 34 | XmlSerializer serialize = new XmlSerializer (typeof(List)); 35 | return (List)serialize.Deserialize (reader); 36 | } 37 | } else { 38 | return new List (); 39 | } 40 | } 41 | set { 42 | using (var writer = new StreamWriter(xmlPath)) { 43 | XmlSerializer serialize = new XmlSerializer (typeof(List)); 44 | serialize.Serialize (writer, value); 45 | } 46 | } 47 | } 48 | 49 | TypeDate GetTypeData (string guid) 50 | { 51 | if (fileTypeList.Exists (c => c.guid == guid) == false) { 52 | 53 | var path = AssetDatabase.GUIDToAssetPath(guid); 54 | 55 | fileTypeList.Add (new TypeDate (){ 56 | guid = guid, 57 | fileName = path, 58 | timeStamp = File.GetLastWriteTime(path) 59 | }); 60 | } 61 | 62 | return fileTypeList.First (c => c.guid == guid); 63 | } 64 | 65 | private bool isSaveEditorCode = false; 66 | 67 | public ClassReferenceCollection (bool saveStiroCode = false) 68 | { 69 | isSaveEditorCode = saveStiroCode; 70 | fileTypeList = fileTypeXML; 71 | } 72 | 73 | public void Init (List refs) 74 | { 75 | references = refs; 76 | } 77 | 78 | public void CollectionFiles () 79 | { 80 | 81 | // connect each classes. 82 | var firstPassList = new List (); 83 | if (Directory.Exists ("Assets/Plugins")) 84 | firstPassList.AddRange (CodeList ("Assets/Plugins")); 85 | if (Directory.Exists ("Assets/Standard Assets")) 86 | firstPassList.AddRange (CodeList ("Assets/Standard Assets")); 87 | 88 | // Connect the files and class. 89 | var codes = CodeList ("Assets/").Where (c => firstPassList.Contains (c) == false); 90 | 91 | var allFirstpassTypes = collectionAllFastspassClasses (); 92 | CollectionCodeFileDictionary (allFirstpassTypes, firstPassList.ToArray ()); 93 | 94 | var alltypes = CollectionAllClasses (); 95 | CollectionCodeFileDictionary (alltypes, codes.ToArray ()); 96 | alltypes.AddRange (allFirstpassTypes); 97 | 98 | 99 | fileTypeXML = fileTypeList; 100 | 101 | foreach (var type in alltypes) { 102 | List list = null; 103 | if (code2FileDic.ContainsKey (type) == false) { 104 | list = new List (); 105 | code2FileDic.Add (type, list); 106 | } else { 107 | list = code2FileDic [type]; 108 | } 109 | 110 | var fullName = type.FullName; 111 | var assembly = type.Assembly.FullName; 112 | if (fileTypeList.Exists (c => c.assemblly == assembly && c.typeFullName.Contains (fullName))) { 113 | var datas = fileTypeList.Where (c => c.assemblly == assembly && c.typeFullName.Contains (fullName)); 114 | foreach (var data in datas) { 115 | list.Add (data.guid); 116 | } 117 | } 118 | } 119 | 120 | float count = 1, max = firstPassList.Count; 121 | foreach (var codepath in firstPassList) { 122 | EditorUtility.DisplayProgressBar ("analytics", codepath, count++ / max); 123 | CollectionReferenceClasses (AssetDatabase.AssetPathToGUID (codepath), allFirstpassTypes); 124 | } 125 | count = 1; 126 | max = codes.Count(); 127 | foreach (var codepath in codes) { 128 | EditorUtility.DisplayProgressBar ("analytics", codepath, count++ / max); 129 | CollectionReferenceClasses (AssetDatabase.AssetPathToGUID (codepath), alltypes); 130 | } 131 | 132 | if (isSaveEditorCode) { 133 | CollectionCustomEditorClasses (alltypes); 134 | } 135 | } 136 | 137 | List CodeList (string path) 138 | { 139 | string[] codes = Directory.GetFiles (path, "*.cs", SearchOption.AllDirectories); 140 | 141 | List needUpdateFileList = new List (); 142 | 143 | foreach (var code in codes) { 144 | var guid = AssetDatabase.AssetPathToGUID (code); 145 | if (fileTypeList.Exists (c => c.guid == guid) == false) { 146 | needUpdateFileList.Add (code); 147 | continue; 148 | } 149 | 150 | var filetype = GetTypeData (guid); 151 | 152 | var timeStamp = filetype.timeStamp; 153 | var time = File.GetLastWriteTime (code); 154 | if (time != timeStamp) { 155 | filetype.timeStamp = time; 156 | needUpdateFileList.Add (code); 157 | continue; 158 | } 159 | } 160 | return needUpdateFileList; 161 | } 162 | 163 | void CollectionCodeFileDictionary (List alltypes, string[] codes) 164 | { 165 | float count = 1; 166 | foreach (var codePath in codes) { 167 | EditorUtility.DisplayProgressBar ("checking", "search files", count++ / codes.Length); 168 | 169 | // connect file and classes. 170 | var code = StripComment (System.IO.File.ReadAllText (codePath)); 171 | var guid = AssetDatabase.AssetPathToGUID (codePath); 172 | 173 | var typeList = GetTypeData (guid); 174 | typeList.typeFullName.Clear (); 175 | 176 | foreach (var type in alltypes) { 177 | 178 | if (type.IsNested) { 179 | continue; 180 | } 181 | 182 | if (string.IsNullOrEmpty (type.Namespace) == false) { 183 | var namespacepattern = string.Format ("namespace\\s*{0}[{{\\s\\n]", type.Namespace); 184 | if (Regex.IsMatch (code, namespacepattern) == false) { 185 | continue; 186 | } 187 | } 188 | 189 | string typeName = type.IsGenericTypeDefinition ? type.GetGenericTypeDefinition ().Name.Split ('`') [0] : type.Name; 190 | if (type.IsClass) { 191 | if (Regex.IsMatch (code, string.Format ("class\\s*{0}?[\\s:<{{]", typeName))) { 192 | typeList.Add (type); 193 | 194 | var nested = type.GetNestedTypes (BindingFlags.Public | BindingFlags.Instance); 195 | 196 | foreach (var nestedType in nested) { 197 | typeList.Add (nestedType); 198 | } 199 | 200 | continue; 201 | } 202 | }else if( type.IsInterface){ 203 | 204 | if (Regex.IsMatch (code, string.Format ("interface\\s*{0}[\\s<{{]", typeName))) { 205 | typeList.Add (type); 206 | continue; 207 | } 208 | } else if (type.IsEnum) { 209 | 210 | if (Regex.IsMatch (code, string.Format ("enum\\s*{0}[\\s{{]", type.Name))) { 211 | typeList.Add (type); 212 | continue; 213 | } 214 | } else { 215 | if (Regex.IsMatch (code, string.Format ("struct\\s*{0}[\\s:<{{]", typeName))) { 216 | typeList.Add (type); 217 | continue; 218 | } 219 | if (Regex.IsMatch (code, string.Format ("delegate\\s*{0}\\s\\(", typeName))) { 220 | typeList.Add (type); 221 | continue; 222 | } 223 | } 224 | } 225 | } 226 | } 227 | 228 | List CollectionAllClasses () 229 | { 230 | List alltypes = new List (); 231 | 232 | if (File.Exists ("Library/ScriptAssemblies/Assembly-CSharp.dll")) 233 | alltypes.AddRange (Assembly.LoadFile ("Library/ScriptAssemblies/Assembly-CSharp.dll").GetTypes ()); 234 | if (isSaveEditorCode && File.Exists ("Library/ScriptAssemblies/Assembly-CSharp-Editor.dll")) 235 | alltypes.AddRange (Assembly.LoadFile ("Library/ScriptAssemblies/Assembly-CSharp-Editor.dll").GetTypes ()); 236 | 237 | return alltypes .ToList (); 238 | } 239 | 240 | List collectionAllFastspassClasses () 241 | { 242 | List alltypes = new List (); 243 | if (File.Exists ("Library/ScriptAssemblies/Assembly-CSharp-firstpass.dll")) 244 | alltypes.AddRange (Assembly.LoadFile ("Library/ScriptAssemblies/Assembly-CSharp-firstpass.dll").GetTypes ()); 245 | if (isSaveEditorCode && File.Exists ("Library/ScriptAssemblies/Assembly-CSharp-Editor-firstpass.dll")) 246 | alltypes.AddRange (Assembly.LoadFile ("Library/ScriptAssemblies/Assembly-CSharp-Editor-firstpass.dll").GetTypes ()); 247 | return alltypes; 248 | } 249 | 250 | public static string StripComment (string code) 251 | { 252 | code = Regex.Replace (code, "//.*[\\n\\r]", ""); 253 | code = Regex.Replace (code, "/\\*.*[\\n\\r]\\*/", ""); 254 | return code; 255 | } 256 | 257 | void CollectionReferenceClasses (string guid, List types) 258 | { 259 | var codePath = AssetDatabase.GUIDToAssetPath (guid); 260 | if (string.IsNullOrEmpty (codePath) || File.Exists (codePath) == false) { 261 | return; 262 | } 263 | 264 | var code = StripComment (System.IO.File.ReadAllText (codePath)); 265 | 266 | List referenceList = null; 267 | CollectionData reference = null; 268 | 269 | if (references.Exists (c => c.fileGuid == guid) == false) { 270 | referenceList = new List (); 271 | reference = new CollectionData () { 272 | fileGuid = guid, 273 | referenceGids = referenceList, 274 | }; 275 | references.Add (reference); 276 | } else { 277 | reference = references.Find (c => c.fileGuid == guid); 278 | referenceList = reference.referenceGids; 279 | } 280 | 281 | referenceList.Clear (); 282 | 283 | var timestamp = File.GetLastWriteTime (codePath); 284 | reference.timeStamp = timestamp; 285 | 286 | foreach (var type in types) { 287 | 288 | if (code2FileDic.ContainsKey (type) == false || code2FileDic [type].Contains (guid)) { 289 | continue; 290 | } 291 | 292 | if (string.IsNullOrEmpty (type.Namespace) == false) { 293 | var namespacepattern = string.Format ("([namespace|using][\\s]{0}[{{\\s\\r\\n\\r;]|{0}\\.)", type.Namespace); 294 | if (Regex.IsMatch (code, namespacepattern) == false) { 295 | continue; 296 | } 297 | } 298 | 299 | string match = string.Empty; 300 | 301 | if (type.IsGenericTypeDefinition) { 302 | string typeName = type.GetGenericTypeDefinition ().Name.Split ('`') [0]; 303 | match = string.Format ("[!|&\\]\\[\\.\\s<(]{0}[\\.\\s\\n\\r>,<(){{]", typeName); 304 | 305 | } else { 306 | string typeName = type.Name.Split ('`') [0].Replace ("Attribute", ""); 307 | match = string.Format ("[!|&\\]\\[\\.\\s<(]{0}[\\.\\s\\n\\r>,<(){{\\]]", typeName); 308 | 309 | 310 | // check Extension Methods 311 | 312 | if (Regex.IsMatch (code, string.Format ("this\\s{0}\\s", typeName))) { 313 | foreach (var file in code2FileDic[type]) { 314 | foreach (var baseReference in references.Where(c=>c.fileGuid == file)) { 315 | baseReference.referenceGids.Add (guid); 316 | } 317 | } 318 | } 319 | } 320 | if (Regex.IsMatch (code, match)) { 321 | var typeGuids = code2FileDic [type]; 322 | foreach (var typeGuid in typeGuids) { 323 | 324 | if (referenceList.Contains (typeGuid) == false) { 325 | referenceList.Add (typeGuid); 326 | } 327 | } 328 | } 329 | } 330 | } 331 | 332 | void CollectionCustomEditorClasses (IEnumerable types) 333 | { 334 | foreach (var type in types) { 335 | 336 | if (code2FileDic.ContainsKey (type) == false) { 337 | continue; 338 | } 339 | 340 | var attributes = type.GetCustomAttributes (typeof(CustomEditor), true); 341 | foreach (var attribute in attributes) { 342 | if (attribute is CustomEditor == false) { 343 | continue; 344 | } 345 | var customEditor = attribute as CustomEditor; 346 | var customEditorReferenceTypeField = typeof(CustomEditor).GetField ("m_InspectedType", BindingFlags.Instance | BindingFlags.NonPublic); 347 | var customEditorReferenceType = (System.Type)customEditorReferenceTypeField.GetValue (customEditor); 348 | 349 | if (code2FileDic.ContainsKey (customEditorReferenceType) == false) { 350 | continue; 351 | } 352 | 353 | foreach (var filePath in code2FileDic[customEditorReferenceType]) { 354 | if (references.Exists (c => c.fileGuid == filePath) == false) { 355 | continue; 356 | } 357 | foreach (var refs in references.Where(c=>c.fileGuid == filePath)) { 358 | var list = refs.referenceGids; 359 | list.AddRange (code2FileDic [type]); 360 | } 361 | } 362 | } 363 | } 364 | } 365 | } 366 | } 367 | -------------------------------------------------------------------------------- /Assets/Cleaner/Editor/ClassReferenceCollection.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 202c278a17939b24c8b79c0ee1f94d8f 3 | labels: 4 | - ActionGame 5 | timeCreated: 1436894500 6 | licenseType: Pro 7 | MonoImporter: 8 | serializedVersion: 2 9 | defaultReferences: [] 10 | executionOrder: 0 11 | icon: {instanceID: 0} 12 | userData: 13 | assetBundleName: 14 | assetBundleVariant: 15 | -------------------------------------------------------------------------------- /Assets/Cleaner/Editor/CollectionData.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using System; 5 | using System.Linq; 6 | 7 | [System.Serializable] 8 | public class CollectionData 9 | { 10 | public string fileGuid; 11 | public string fileName; 12 | public List referenceGids = new List(); 13 | public DateTime timeStamp; 14 | } 15 | 16 | [System.Serializable] 17 | public class TypeDate 18 | { 19 | public string guid; 20 | public string fileName; 21 | public DateTime timeStamp; 22 | public List typeFullName = new List(); 23 | public string assemblly; 24 | 25 | public void Add(Type addtype){ 26 | assemblly = addtype.Assembly.FullName; 27 | var typeName = addtype.FullName; 28 | if( typeFullName.Contains(typeName) == false){ 29 | typeFullName.Add(typeName); 30 | } 31 | } 32 | 33 | public Type[] types{ 34 | get{ 35 | return typeFullName.Select(c=>Type.GetType(c)).ToArray(); 36 | } 37 | } 38 | } 39 | 40 | public interface IReferenceCollection 41 | { 42 | void CollectionFiles(); 43 | void Init(List refs); 44 | } 45 | 46 | -------------------------------------------------------------------------------- /Assets/Cleaner/Editor/CollectionData.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0d05386265df34bac8d0b6df44aa494c 3 | labels: 4 | - ActionGame 5 | timeCreated: 1438682377 6 | licenseType: Pro 7 | MonoImporter: 8 | serializedVersion: 2 9 | defaultReferences: [] 10 | executionOrder: 0 11 | icon: {instanceID: 0} 12 | userData: 13 | assetBundleName: 14 | assetBundleVariant: 15 | -------------------------------------------------------------------------------- /Assets/Cleaner/Editor/FindUnusedAssetsWindow.cs: -------------------------------------------------------------------------------- 1 | /** 2 | asset cleaner 3 | Copyright (c) 2015 Tatsuhiko Yamamura 4 | 5 | This software is released under the MIT License. 6 | http://opensource.org/licenses/mit-license.php 7 | */ 8 | using UnityEngine; 9 | using System.Collections; 10 | using System.Collections.Generic; 11 | using UnityEditor; 12 | using System.IO; 13 | using System.Linq; 14 | 15 | namespace AssetClean 16 | { 17 | public class FindUnusedAssetsWindow : EditorWindow 18 | { 19 | AssetCollector collection = new AssetCollector (); 20 | List deleteAssets = new List (); 21 | Vector2 scroll; 22 | 23 | [MenuItem("Window/Delete Unused Assets/only resource", false, 50)] 24 | static void InitWithoutCode () 25 | { 26 | var window = FindUnusedAssetsWindow.CreateInstance (); 27 | window.collection.useCodeStrip = false; 28 | window.collection.Collection (new string[]{"Assets"}); 29 | window.CopyDeleteFileList (window.collection.deleteFileList); 30 | 31 | window.Show (); 32 | } 33 | 34 | [MenuItem("Window/Delete Unused Assets/unused by editor", false, 51)] 35 | static void InitWithout () 36 | { 37 | var window = FindUnusedAssetsWindow.CreateInstance (); 38 | window.collection.Collection (new string[]{"Assets"}); 39 | window.CopyDeleteFileList (window.collection.deleteFileList); 40 | 41 | window.Show (); 42 | } 43 | 44 | [MenuItem("Window/Delete Unused Assets/unused by game", false, 52)] 45 | static void Init () 46 | { 47 | var window = FindUnusedAssetsWindow.CreateInstance (); 48 | window.collection.saveEditorExtensions = false; 49 | window.collection.Collection (new string[]{"Assets"}); 50 | window.CopyDeleteFileList (window.collection.deleteFileList); 51 | 52 | window.Show (); 53 | } 54 | 55 | // [MenuItem("Assets/Delete Unused Assets/unused by editor", false, 52)] 56 | // static void InitAssets () 57 | // { 58 | // var paths = Selection.objects 59 | // .Select(c=>AssetDatabase.GetAssetPath(c)) 60 | // .Where(c=>Directory.Exists(c)); 61 | // if( paths.Any(c=> string.IsNullOrEmpty(c) ) ){ 62 | // return; 63 | // } 64 | // 65 | // var window = FindUnusedAssetsWindow.CreateInstance (); 66 | // window.collection.Collection (paths.ToArray()); 67 | // window.CopyDeleteFileList (window.collection.deleteFileList); 68 | // 69 | // window.Show (); 70 | // } 71 | // 72 | // [MenuItem("Assets/Delete Unused Assets/unused by editor", true)] 73 | // static bool InitAssetsA () 74 | // { 75 | // var paths = Selection.objects 76 | // .Select(c=>AssetDatabase.GetAssetPath(c)) 77 | // .Where(c=>Directory.Exists(c)); 78 | // return ! paths.Any(c=> string.IsNullOrEmpty(c) ); 79 | // } 80 | 81 | 82 | 83 | [MenuItem("Assets/Delete Unused Assets/unused only resources", false, 52)] 84 | static void InitAssetsOnlyResources () 85 | { 86 | var paths = Selection.objects 87 | .Select(c=>AssetDatabase.GetAssetPath(c)) 88 | .Where(c=>Directory.Exists(c)); 89 | if( paths.Any(c=> string.IsNullOrEmpty(c) ) ){ 90 | return; 91 | } 92 | 93 | var window = FindUnusedAssetsWindow.CreateInstance (); 94 | window.collection.useCodeStrip = false; 95 | window.collection.Collection (paths.ToArray()); 96 | window.CopyDeleteFileList (window.collection.deleteFileList); 97 | 98 | window.Show (); 99 | } 100 | [MenuItem("Assets/Delete Unused Assets/unused only resources", true)] 101 | static bool InitAssetsOnlyResourcesA () 102 | { 103 | var paths = Selection.objects 104 | .Select(c=>AssetDatabase.GetAssetPath(c)) 105 | .Where(c=>Directory.Exists(c)); 106 | return ! paths.Any(c=> string.IsNullOrEmpty(c) ); 107 | } 108 | 109 | [MenuItem("Window/Delete Unused Assets/Clear cache")] 110 | static void ClearCache() 111 | { 112 | File.Delete(AssetClean.AssetCollector.exportXMLPath); 113 | File.Delete(AssetClean.ClassReferenceCollection.xmlPath); 114 | 115 | EditorUtility.DisplayDialog("clear file", "clear file", "OK"); 116 | } 117 | 118 | 119 | void OnGUI () 120 | { 121 | using (var horizonal = new EditorGUILayout.HorizontalScope("box")) { 122 | EditorGUILayout.LabelField ("delete unreference assets from buildsettings and resources"); 123 | } 124 | 125 | using (var scrollScope = new EditorGUILayout.ScrollViewScope(scroll)) { 126 | scroll = scrollScope.scrollPosition; 127 | foreach (var asset in deleteAssets) { 128 | if (string.IsNullOrEmpty (asset.path)) { 129 | continue; 130 | } 131 | 132 | using (var horizonal = new EditorGUILayout.HorizontalScope()) { 133 | asset.isDelete = EditorGUILayout.Toggle (asset.isDelete, GUILayout.Width (20)); 134 | var icon = AssetDatabase.GetCachedIcon (asset.path); 135 | GUILayout.Label (icon, GUILayout.Width (20), GUILayout.Height (20)); 136 | if (GUILayout.Button (asset.path, EditorStyles.largeLabel)) { 137 | Selection.activeObject = AssetDatabase.LoadAssetAtPath (asset.path); 138 | } 139 | } 140 | } 141 | 142 | 143 | } 144 | using (var horizonal = new EditorGUILayout.HorizontalScope("box")) { 145 | EditorGUILayout.Space(); 146 | if (GUILayout.Button ("Exclude from Project", GUILayout.Width (160)) && deleteAssets.Count != 0) { 147 | EditorApplication.delayCall += Exclude; 148 | } 149 | } 150 | 151 | } 152 | 153 | void Exclude() 154 | { 155 | RemoveFiles (); 156 | Close (); 157 | } 158 | 159 | static void CleanDir() 160 | { 161 | RemoveEmptyDirectry ("Assets"); 162 | AssetDatabase.Refresh (); 163 | } 164 | 165 | void CopyDeleteFileList(IEnumerable deleteFileList) 166 | { 167 | foreach (var asset in deleteFileList) { 168 | var filePath = AssetDatabase.GUIDToAssetPath (asset); 169 | if (string.IsNullOrEmpty (filePath) == false) { 170 | deleteAssets.Add (new DeleteAsset (){ path = filePath}); 171 | } 172 | } 173 | } 174 | 175 | void RemoveFiles () 176 | { 177 | try { 178 | string exportDirectry = "BackupUnusedAssets"; 179 | Directory.CreateDirectory (exportDirectry); 180 | var files = deleteAssets.Where (item => item.isDelete == true).Select (item => item.path).ToArray (); 181 | string backupPackageName = exportDirectry + "/package" + System.DateTime.Now.ToString ("yyyyMMddHHmmss") + ".unitypackage"; 182 | EditorUtility.DisplayProgressBar ("export package", backupPackageName, 0); 183 | 184 | AssetDatabase.ExportPackage (files, backupPackageName); 185 | 186 | int i = 0; 187 | int length = deleteAssets.Count; 188 | 189 | foreach (var assetPath in files) { 190 | i++; 191 | EditorUtility.DisplayProgressBar ("delete unused assets", assetPath, (float)i / length); 192 | AssetDatabase.DeleteAsset (assetPath); 193 | if( File.Exists(assetPath) ){ 194 | File.Delete(assetPath); 195 | } 196 | } 197 | 198 | EditorUtility.DisplayProgressBar ("clean directory", "", 1); 199 | foreach (var dir in Directory.GetDirectories("Assets")) { 200 | RemoveEmptyDirectry (dir); 201 | } 202 | 203 | System.Diagnostics.Process.Start (exportDirectry); 204 | 205 | AssetDatabase.Refresh (); 206 | } 207 | catch( System.Exception e ){ 208 | Debug.Log(e.Message); 209 | }finally { 210 | EditorUtility.ClearProgressBar (); 211 | } 212 | } 213 | 214 | static void RemoveEmptyDirectry (string path) 215 | { 216 | var dirs = Directory.GetDirectories (path); 217 | foreach (var dir in dirs) { 218 | RemoveEmptyDirectry (dir); 219 | } 220 | 221 | 222 | var files = Directory.GetFiles (path, "*", SearchOption.TopDirectoryOnly).Where (item => Path.GetExtension (item) != ".meta"); 223 | if (files.Count () == 0 && Directory.GetDirectories (path).Count () == 0) { 224 | var metaFile = AssetDatabase.GetTextMetaFilePathFromAssetPath(path); 225 | UnityEditor.FileUtil.DeleteFileOrDirectory (path); 226 | UnityEditor.FileUtil.DeleteFileOrDirectory (metaFile); 227 | } 228 | } 229 | 230 | class DeleteAsset 231 | { 232 | public bool isDelete = true; 233 | public string path; 234 | } 235 | } 236 | } 237 | -------------------------------------------------------------------------------- /Assets/Cleaner/Editor/FindUnusedAssetsWindow.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 74eec3bfba0594259ac2843353c082a3 3 | labels: 4 | - ActionGame 5 | timeCreated: 1437724294 6 | licenseType: Pro 7 | MonoImporter: 8 | serializedVersion: 2 9 | defaultReferences: [] 10 | executionOrder: 0 11 | icon: {instanceID: 0} 12 | userData: 13 | assetBundleName: 14 | assetBundleVariant: 15 | -------------------------------------------------------------------------------- /Assets/Cleaner/Editor/ShaderReferenceCollection.cs: -------------------------------------------------------------------------------- 1 | /** 2 | asset cleaner 3 | Copyright (c) 2015 Tatsuhiko Yamamura 4 | 5 | This software is released under the MIT License. 6 | http://opensource.org/licenses/mit-license.php 7 | */ 8 | using UnityEngine; 9 | using System.Collections; 10 | using System.Collections.Generic; 11 | using System.IO; 12 | using System.Text.RegularExpressions; 13 | using UnityEditor; 14 | 15 | namespace AssetClean 16 | { 17 | public class ShaderReferenceCollection : IReferenceCollection 18 | { 19 | // shader name / shader file guid 20 | public Dictionary shaderFileList = new Dictionary (); 21 | private List references = new List(); 22 | 23 | public void Init(List refs){ 24 | references = refs; 25 | } 26 | 27 | public void CollectionFiles () 28 | { 29 | CollectionShaderFiles (); 30 | CheckReference (); 31 | } 32 | 33 | void CollectionShaderFiles () 34 | { 35 | var shaderFiles = Directory.GetFiles ("Assets", "*.shader", SearchOption.AllDirectories); 36 | foreach (var shaderFilePath in shaderFiles) { 37 | var code = File.ReadAllText (shaderFilePath); 38 | var match = Regex.Match (code, "Shader \"(?.*)\""); 39 | if (match.Success) { 40 | var shaderName = match.Groups ["name"].ToString (); 41 | if (shaderFileList.ContainsKey (shaderName) == false) { 42 | shaderFileList.Add (shaderName, AssetDatabase.AssetPathToGUID(shaderFilePath)); 43 | } 44 | } 45 | } 46 | 47 | var cgFiles = Directory.GetFiles ("Assets", "*.cg", SearchOption.AllDirectories); 48 | foreach (var cgFilePath in cgFiles) { 49 | var file = Path.GetFileName (cgFilePath); 50 | shaderFileList.Add (file, cgFilePath); 51 | } 52 | 53 | var cgincFiles = Directory.GetFiles ("Assets", "*.cginc", SearchOption.AllDirectories); 54 | foreach (var cgincPath in cgincFiles) { 55 | var file = Path.GetFileName (cgincPath); 56 | if( shaderFileList.ContainsKey(file) == false ){ 57 | shaderFileList.Add (file, cgincPath); 58 | } 59 | } 60 | } 61 | 62 | void CheckReference () 63 | { 64 | foreach (var shader in shaderFileList) { 65 | var shaderFilePath = AssetDatabase.GUIDToAssetPath(shader.Value); 66 | if( File.Exists(shaderFilePath) == false){ 67 | continue; 68 | } 69 | 70 | var guid = shader.Value; 71 | 72 | List referenceList = null; 73 | CollectionData reference = null; 74 | 75 | if( references.Exists(c=>c.fileGuid == guid) == false ) { 76 | referenceList = new List(); 77 | reference = new CollectionData() { 78 | fileGuid = guid, 79 | referenceGids = referenceList, 80 | }; 81 | references.Add(reference); 82 | }else{ 83 | reference = references.Find(c=>c.fileGuid == guid); 84 | referenceList = reference.referenceGids; 85 | } 86 | 87 | reference.timeStamp = File.GetLastWriteTime(AssetDatabase.GUIDToAssetPath(guid)); 88 | 89 | var code = ClassReferenceCollection.StripComment( File.ReadAllText (shaderFilePath)); 90 | 91 | foreach (var checkingShaderName in shaderFileList.Keys) { 92 | if( checkingShaderName == shader.Key ){ 93 | continue; 94 | } 95 | 96 | if (code.IndexOf(checkingShaderName) != -1 && shaderFileList.ContainsKey(checkingShaderName)) { 97 | var fileGuid = shaderFileList [checkingShaderName]; 98 | if( referenceList.Contains(fileGuid) == false ){ 99 | referenceList.Add (fileGuid); 100 | } 101 | } 102 | } 103 | } 104 | } 105 | } 106 | } -------------------------------------------------------------------------------- /Assets/Cleaner/Editor/ShaderReferenceCollection.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2c4f01a79a77a45a9a84004cc2b78098 3 | labels: 4 | - ActionGame 5 | timeCreated: 1437706430 6 | licenseType: Pro 7 | MonoImporter: 8 | serializedVersion: 2 9 | defaultReferences: [] 10 | executionOrder: 0 11 | icon: {instanceID: 0} 12 | userData: 13 | assetBundleName: 14 | assetBundleVariant: 15 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 yamamura tatsuhiko 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /ProjectSettings/AudioManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unity-cn/Tool-UnityAssetCleaner/e93e6dc0f4e4e79e67cf519e8e1b32266629a8f0/ProjectSettings/AudioManager.asset -------------------------------------------------------------------------------- /ProjectSettings/ClusterInputManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unity-cn/Tool-UnityAssetCleaner/e93e6dc0f4e4e79e67cf519e8e1b32266629a8f0/ProjectSettings/ClusterInputManager.asset -------------------------------------------------------------------------------- /ProjectSettings/DynamicsManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unity-cn/Tool-UnityAssetCleaner/e93e6dc0f4e4e79e67cf519e8e1b32266629a8f0/ProjectSettings/DynamicsManager.asset -------------------------------------------------------------------------------- /ProjectSettings/EditorBuildSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unity-cn/Tool-UnityAssetCleaner/e93e6dc0f4e4e79e67cf519e8e1b32266629a8f0/ProjectSettings/EditorBuildSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/EditorSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unity-cn/Tool-UnityAssetCleaner/e93e6dc0f4e4e79e67cf519e8e1b32266629a8f0/ProjectSettings/EditorSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/GraphicsSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unity-cn/Tool-UnityAssetCleaner/e93e6dc0f4e4e79e67cf519e8e1b32266629a8f0/ProjectSettings/GraphicsSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/InputManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unity-cn/Tool-UnityAssetCleaner/e93e6dc0f4e4e79e67cf519e8e1b32266629a8f0/ProjectSettings/InputManager.asset -------------------------------------------------------------------------------- /ProjectSettings/NavMeshAreas.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unity-cn/Tool-UnityAssetCleaner/e93e6dc0f4e4e79e67cf519e8e1b32266629a8f0/ProjectSettings/NavMeshAreas.asset -------------------------------------------------------------------------------- /ProjectSettings/NetworkManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unity-cn/Tool-UnityAssetCleaner/e93e6dc0f4e4e79e67cf519e8e1b32266629a8f0/ProjectSettings/NetworkManager.asset -------------------------------------------------------------------------------- /ProjectSettings/Physics2DSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unity-cn/Tool-UnityAssetCleaner/e93e6dc0f4e4e79e67cf519e8e1b32266629a8f0/ProjectSettings/Physics2DSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/ProjectSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unity-cn/Tool-UnityAssetCleaner/e93e6dc0f4e4e79e67cf519e8e1b32266629a8f0/ProjectSettings/ProjectSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/ProjectVersion.txt: -------------------------------------------------------------------------------- 1 | m_EditorVersion: 5.3.0f4 2 | m_StandardAssetsVersion: 0 3 | -------------------------------------------------------------------------------- /ProjectSettings/QualitySettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unity-cn/Tool-UnityAssetCleaner/e93e6dc0f4e4e79e67cf519e8e1b32266629a8f0/ProjectSettings/QualitySettings.asset -------------------------------------------------------------------------------- /ProjectSettings/TagManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unity-cn/Tool-UnityAssetCleaner/e93e6dc0f4e4e79e67cf519e8e1b32266629a8f0/ProjectSettings/TagManager.asset -------------------------------------------------------------------------------- /ProjectSettings/TimeManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unity-cn/Tool-UnityAssetCleaner/e93e6dc0f4e4e79e67cf519e8e1b32266629a8f0/ProjectSettings/TimeManager.asset -------------------------------------------------------------------------------- /ProjectSettings/UnityAdsSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unity-cn/Tool-UnityAssetCleaner/e93e6dc0f4e4e79e67cf519e8e1b32266629a8f0/ProjectSettings/UnityAdsSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/UnityConnectSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unity-cn/Tool-UnityAssetCleaner/e93e6dc0f4e4e79e67cf519e8e1b32266629a8f0/ProjectSettings/UnityConnectSettings.asset -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | #UnityAssetCleaner 2 | ![https://raw.github.com/wiki/tsubaki/UnityAssetCleaner/title.png](https://raw.github.com/wiki/tsubaki/UnityAssetCleaner/title.png) 3 | 4 | UnityAssetCleaner will remove unused assets, script and shader in your game and projects. 5 | 6 | ##how to use 7 | 8 | 1. select menu/window/delete unused assets/unused by editor. 9 | ![https://raw.github.com/wiki/tsubaki/UnityAssetCleaner/unusedbyeditor.png](https://raw.github.com/wiki/tsubaki/UnityAssetCleaner/unusedbyeditor.png) 10 | 2. editor lists unused assets from your game. 11 | if you do not want to delete it, you can uncheck it. 12 | ![https://raw.github.com/wiki/tsubaki/UnityAssetCleaner/lists.png](https://raw.github.com/wiki/tsubaki/UnityAssetCleaner/lists.png) 13 | 3. select "Exclude from project" 14 | export unused assets by unitypackage. 15 | ![https://raw.github.com/wiki/tsubaki/UnityAssetCleaner/export.png](https://raw.github.com/wiki/tsubaki/UnityAssetCleaner/export.png) 16 | 17 | if you want to remove resource only, you can use menu/window/delete unused assets/resource only. 18 | 19 | ##Note 20 | 21 | Delete of judgment, to determine from dependence from BuildSettings and Resources. 22 | 23 | ##tips 24 | 25 | please use “menu/window/delete unused assets/cache clear” in some time. 26 | sometimes work incorrectly if not cache clear. 27 | -------------------------------------------------------------------------------- /cleaner.unitypackage: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unity-cn/Tool-UnityAssetCleaner/e93e6dc0f4e4e79e67cf519e8e1b32266629a8f0/cleaner.unitypackage --------------------------------------------------------------------------------