Skip to content

Instantly share code, notes, and snippets.

@ianwaldrop
Last active January 29, 2018 18:53
Show Gist options
  • Save ianwaldrop/6af32128bf3b09581fc8 to your computer and use it in GitHub Desktop.
Save ianwaldrop/6af32128bf3b09581fc8 to your computer and use it in GitHub Desktop.
Editor script to find all project assets of the given type.
public static IEnumerable<T> FindAssetsOfType<T> () where T : UnityEngine.Object
{
return AssetDatabase.FindAssets ("t:" + typeof (T).Name)
.Select (AssetDatabase.GUIDToAssetPath)
.Select ((T)AssetDatabase.LoadMainAssetAtPath);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment