Created
June 19, 2020 07:24
-
-
Save Unity-Javier/f772a9b0a8077f642e15ca71983f237f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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