Création 4
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8a39cb0f068e62a43b27c161b50488e6
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2f5dc487c1cf7ac46bb74103c24eab7a
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,66 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
||||
public class UnusedAssetFinder
|
||||
{
|
||||
[MenuItem("Tools/Find Unused Assets")]
|
||||
static void FindUnusedAssets()
|
||||
{
|
||||
string[] allAssetPaths = AssetDatabase.GetAllAssetPaths()
|
||||
.Where(path => path.StartsWith("Assets/") && !AssetDatabase.IsValidFolder(path))
|
||||
.ToArray();
|
||||
|
||||
HashSet<string> usedAssets = new HashSet<string>();
|
||||
|
||||
string[] scenes = EditorBuildSettings.scenes
|
||||
.Where(s => s.enabled)
|
||||
.Select(s => s.path)
|
||||
.ToArray();
|
||||
|
||||
string[] prefabPaths = AssetDatabase.FindAssets("t:Prefab")
|
||||
.Select(AssetDatabase.GUIDToAssetPath)
|
||||
.ToArray();
|
||||
|
||||
string[] dependencies = AssetDatabase.GetDependencies(scenes.Concat(prefabPaths).ToArray(), true);
|
||||
foreach (string dep in dependencies)
|
||||
{
|
||||
usedAssets.Add(dep);
|
||||
}
|
||||
|
||||
List<string> unusedAssets = allAssetPaths
|
||||
.Where(path => !usedAssets.Contains(path))
|
||||
.ToList();
|
||||
|
||||
List<string> reportLines = new List<string>();
|
||||
long totalSize = 0;
|
||||
|
||||
reportLines.Add("Assets non utilisés (avec taille en Ko) :\n");
|
||||
|
||||
foreach (string assetPath in unusedAssets)
|
||||
{
|
||||
string fullPath = Path.Combine(Directory.GetCurrentDirectory(), assetPath);
|
||||
if (File.Exists(fullPath))
|
||||
{
|
||||
long sizeBytes = new FileInfo(fullPath).Length;
|
||||
long sizeKB = sizeBytes / 1024;
|
||||
totalSize += sizeBytes;
|
||||
|
||||
reportLines.Add($"{assetPath} - {sizeKB} Ko");
|
||||
}
|
||||
else
|
||||
{
|
||||
reportLines.Add($"{assetPath} - fichier introuvable");
|
||||
}
|
||||
}
|
||||
|
||||
reportLines.Add($"\nTaille totale des fichiers non utilisés : {totalSize / 1024} Ko ({totalSize / (1024 * 1024f):F2} Mo)");
|
||||
|
||||
string outputPath = Path.Combine(Directory.GetCurrentDirectory(), "UnusedAssets.txt");
|
||||
File.WriteAllLines(outputPath, reportLines);
|
||||
|
||||
Debug.Log($"✔️ Analyse terminée : {unusedAssets.Count} fichiers non utilisés détectés.\n📄 Rapport généré dans : {outputPath}");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e84c7df0455d9554e96ac866d3ad7ed4
|
||||
@@ -0,0 +1,15 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: d7fd9488000d3734a9e00ee676215985, type: 3}
|
||||
m_Name: DefaultVolumeProfile
|
||||
m_EditorClassIdentifier:
|
||||
components: []
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0938e3e1c98281f43a8bdeaf8ee1e2d0
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user