Created
May 26, 2019 09:48
-
-
Save sokuhatiku/2fe189748264a231d83089da22a528d2 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
public static IEnumerable<Object> LoadAssetsFromPathWithSubAssets(this IEnumerable<string> paths) | |
{ | |
foreach (var path in paths) | |
{ | |
var assets = AssetDatabase.LoadAllAssetsAtPath(path); | |
if (assets == null || assets.Length == 0) | |
{ | |
yield return AssetDatabase.LoadAssetAtPath<Object>(path); | |
yield break; | |
} | |
foreach (var asset in assets) | |
yield return asset; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment