/// <summary> /// Filters the resources for atlas import. /// </summary> /// <returns>The resources for atlas import.</returns> /// <param name="resources">Resources.</param> public static Object[] FilterResourcesForAtlasImport(Object[] resources) { List <Object> tempList = new List <Object>(); foreach (Object resource in resources) { string resourcePath = SPTools.GetAssetPath(resource); // Check if this is a main asset and queue all it's sub assets if (SPTools.IsMainAsset(resource) && SPTools.HasSubAssets(resource)) { Object[] subAssets = SPTools.FilterResourcesForAtlasImport(SPTools.GetSubAssets(resource)); foreach (Object a in subAssets) { tempList.Add(a); } } else if (resource is Texture2D || resource is Sprite) { tempList.Add(resource); } else if (SPTools.IsDirectory(resourcePath)) { Object[] subAssets = SPTools.FilterResourcesForAtlasImport(SPTools.GetDirectoryAssets(resourcePath)); foreach (Object a in subAssets) { tempList.Add(a); } } } return(tempList.ToArray()); }