Cannot mark assets and scenes in one AssetBundle
Unity3D/Problems 2016. 9. 20. 12:07static void CollectDownloadableAssets(string path, bool isTest = false)
{
Debug.LogFormat("CollectDownloadableAssets[{0}]:{1}", isTest, path);
int testVer = PlayerPrefs.GetInt(VERSION_TEST_KEY);
string[] directoryList = System.IO.Directory.GetDirectories(path);
List<string> scenfolderPath = AssetBundleSettings.Instance.GetSceneFloderPath();
foreach (string directory in directoryList)
{
Debug.LogFormat("directory:{0}", directory);
string dirPath = directory.Replace("\\", "/");
AssetBundleData data = new AssetBundleData(Path.GetFileNameWithoutExtension(directory));
SearchOption searchOption = scenfolderPath.Contains(dirPath) ? SearchOption.TopDirectoryOnly : SearchOption.AllDirectories;
string[] filePaths = Directory.GetFiles(directory, "*.*", searchOption).Where(s => !s.EndsWith(".meta")).ToArray();
int version = isTest ? testVer : 0;
List<Object> files = new List<Object>();
string filePath;
foreach (string p in filePaths)
{
filePath = p.Replace("\\", "/");
if(p.Contains(Application.dataPath))
{
filePath = "Assets" + p.Replace(Application.dataPath, "");
}
// check version file..
if (Path.GetFileName(filePath) == VERSION_FILE_NAME)
{
if (!isTest)
{
Object verObj = AssetDatabase.LoadAssetAtPath(filePath, typeof(Assets.Scripts.Editor.AssetBundleVersion));
version = (verObj as Assets.Scripts.Editor.AssetBundleVersion).version;
}
continue;
}
else if (Path.GetExtension(filePath) == ".asset")
{
continue;
}
Object obj = AssetDatabase.LoadAssetAtPath(filePath, typeof(Object));
if(obj)
{
data.prefabs.Add(obj, filePath);
}
Debug.Log(filePath);
}
data.version = version;
assetDatas.Add(data);
}
}
'Unity3D > Problems' 카테고리의 다른 글
EndOfStreamException: Failed to read past end of stream. (0) | 2016.10.13 |
---|---|
Playmaker AI 설계 (0) | 2016.09.20 |
DX11에서 어셋번들 쉐이더가 깨져 나오는 경우 (0) | 2016.08.29 |
ParticleSystem 3D Start Rotation (0) | 2016.08.19 |
공포의 level_pattern_data (0) | 2016.07.13 |