Beispiel #1
0
        static void ChangeAssetBundleName(string assetFullPath)
        {
            if (assetFullPath.Contains(Constant.EXTENSION_META))
            {
                return;
            }

            var assetSetting    = AssetDatabase.LoadAssetAtPath <AssetSetting>(AssetEditorConstant.ASSET_SETTING_PATH);
            var assetPath       = AssetPath.GetAssetPathFromBundlePath(assetFullPath);
            var assetBundleName = AssetPath.GetBundleName(assetPath, assetFullPath, assetSetting.assetConfig.indvAssetPathList);
            var assetName       = AssetPath.GetAssetName(assetPath);

            var assetImporter = AssetImporter.GetAtPath(assetFullPath);

            if (assetImporter.name != assetName ||
                assetImporter.assetBundleName != assetBundleName)
            {
                assetImporter.assetBundleName = assetBundleName;
                assetImporter.name            = assetName;

                EditorUtility.SetDirty(assetImporter);
            }
        }
Beispiel #2
0
        public static void AddToBundleConfig(string assetFullPath)
        {
            if (Path.GetFileName(assetFullPath) == Constant.ASSET_CONFIG_NAME)
            {
                ChangeAssetConfigBundleName(assetFullPath);
            }
            else
            {
                ChangeAssetBundleName(assetFullPath);

                var assetPath   = AssetPath.GetAssetPathFromBundlePath(assetFullPath);
                var assetConfig = GetAssetConfig();
                assetConfig.Add(new AssetInfo()
                {
                    assetPath    = assetPath,
                    assetName    = AssetPath.GetAssetName(assetPath),
                    bundleName   = AssetPath.GetBundleName(assetPath, assetFullPath, assetConfig.indvAssetPathList),
                    isFromBundle = true
                });

                EditorUtility.SetDirty(assetConfig);
            }
        }