Skip to content

Instantly share code, notes, and snippets.

@Unity-Javier
Created June 19, 2020 07:24
Show Gist options
  • Save Unity-Javier/f772a9b0a8077f642e15ca71983f237f to your computer and use it in GitHub Desktop.
Save Unity-Javier/f772a9b0a8077f642e15ca71983f237f to your computer and use it in GitHub Desktop.
using System.Collections.Generic;
using System.IO;
using System.Linq;
using UnityEditor;
using UnityEngine;
public class FindProblematicAsset
{
[MenuItem("AssetDatabase/ZeroGUID")]
public static void GetZeroGUID()
{
var allFiles = Directory.EnumerateFiles("Assets", "*").ToArray();
var allAssets = new HashSet<string>(AssetDatabase.GetAllAssetPaths());
for(int i = 0; i < allFiles.Length; ++i)
{
//Make sure we have forward slashes only
var curFile = allFiles[i].Replace(@"\", "/");
//Ignore .meta files as they're not part of AssetDatabase.GetAllAssetPaths();
if (!curFile.EndsWith(".meta") && !allAssets.Contains(curFile))
{
Debug.Log($"File path is in project, but not found inside AssetDatabase: {curFile}");
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment