Created
May 21, 2015 03:24
-
-
Save kiyoaki/e239fac49180ba625257 to your computer and use it in GitHub Desktop.
How to set AssetBundleName from editor scripts.
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 class AssetBundleNameGenerator | |
{ | |
[MenuItem("AssetBundles/Set XXX")] | |
public static void SetXXX() | |
{ | |
foreach (var file in Directory | |
.GetFiles("Assets/XXX/XXX/", | |
"*.xxx", SearchOption.TopDirectoryOnly)) | |
{ | |
var importer = AssetImporter.GetAtPath(file); | |
var fileNameWithoutExt = Path.GetFileNameWithoutExtension(file); | |
var assetBundleName = "xxx/xxx/" + fileNameWithoutExt; | |
if (importer.assetBundleName == assetBundleName) | |
{ | |
continue; | |
} | |
importer.assetBundleName = assetBundleName; | |
importer.SaveAndReimport(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment