Advertisement
apieceoffruit

Snippits: Unity Load All Assets

Sep 5th, 2021 (edited)
1,304
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.27 KB | None | 0 0
  1. public static T[] GetAll<T>(string query,
  2. params string[] locations)
  3. where T : UnityEngine.Object =>  
  4.     FindAssets(query, locations)  
  5.         .Select(GUIDToAssetPath)  
  6.         .Select(LoadAssetAtPath<T>)  
  7.         .Where(x => x != null)  
  8.         .ToArray();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement