Skip to content

Commit

Permalink
added load asset from specific package
Browse files Browse the repository at this point in the history
  • Loading branch information
michael811125 committed May 2, 2023
1 parent 969dff4 commit a8039c2
Show file tree
Hide file tree
Showing 39 changed files with 1,548 additions and 462 deletions.
6 changes: 3 additions & 3 deletions Assets/AssetBundleBuilderSetting.asset
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 09788b4733bab2d4792fdd5d28e7653c, type: 3}
m_Name: AssetBundleBuilderSetting
m_EditorClassIdentifier:
BuildPipeline: 0
BuildMode: 0
BuildPipeline: 1
BuildMode: 1
BuildPackage: DefaultPackage
CompressOption: 2
OutputNameStyle: 1
CopyBuildinFileOption: 1
CopyBuildinFileOption: 0
CopyBuildinFileTags:
EncyptionClassName: XorEncryption
45 changes: 45 additions & 0 deletions Assets/AssetBundleCollectorSetting.asset
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,48 @@ MonoBehaviour:
FilterRuleName: CollectAll
AssetTags:
UserData:
- PackageName: OtherPackage
PackageDesc:
Groups:
- GroupName: ModelGroup
GroupDesc:
AssetTags: models
ActiveRuleName: EnableGroup
Collectors:
- CollectPath: Assets/OxGFrame/AssetLoader/Example/Prefabs/model_01.prefab
CollectorGUID: b4ea3356cddbd8b41926c28adefdfbc5
CollectorType: 0
AddressRuleName: AddressByFileName
PackRuleName: PackSeparately
FilterRuleName: CollectAll
AssetTags:
UserData:
- GroupName: SceneGroup
GroupDesc:
AssetTags: scenes
ActiveRuleName: EnableGroup
Collectors:
- CollectPath: Assets/OxGFrame/CoreFrame/Example/USFrameDemo/Scenes/LevelDemo01.unity
CollectorGUID: 97102f27cdcc74846bb0909829b431cd
CollectorType: 0
AddressRuleName: AddressByFileName
PackRuleName: PackSeparately
FilterRuleName: CollectAll
AssetTags:
UserData:
- CollectPath: Assets/OxGFrame/CoreFrame/Example/USFrameDemo/Scenes/LevelDemo02.unity
CollectorGUID: 9f25400e0da4e034294d5e153b0533ab
CollectorType: 0
AddressRuleName: AddressByFileName
PackRuleName: PackSeparately
FilterRuleName: CollectAll
AssetTags:
UserData:
- CollectPath: Assets/OxGFrame/CoreFrame/Example/USFrameDemo/Scenes/LevelDemo03.unity
CollectorGUID: 42b42b7f9b5995748ba85a54431669b3
CollectorType: 0
AddressRuleName: AddressByFileName
PackRuleName: PackSeparately
FilterRuleName: CollectAll
AssetTags:
UserData:
10 changes: 10 additions & 0 deletions Assets/OxGFrame/AssetLoader/Example/BundleDemo/BundleDemo.unity
Original file line number Diff line number Diff line change
Expand Up @@ -1588,6 +1588,16 @@ PrefabInstance:
propertyPath: decryptArgs
value: xor,1
objectReference: {fileID: 0}
- target: {fileID: 5015912702362567919, guid: 992bffa5c79679749861326baa5441c6,
type: 3}
propertyPath: listPackage.Array.size
value: 1
objectReference: {fileID: 0}
- target: {fileID: 5015912702362567919, guid: 992bffa5c79679749861326baa5441c6,
type: 3}
propertyPath: listPackage.Array.data[1]
value: OtherPackage
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 992bffa5c79679749861326baa5441c6, type: 3}
--- !u!1 &571322897
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using OxGFrame.AssetLoader;
using Cysharp.Threading.Tasks;
using OxGFrame.AssetLoader;
using OxGFrame.AssetLoader.Bundle;
using OxGFrame.AssetLoader.PatchEvent;
using OxGFrame.AssetLoader.PatchFsm;
Expand All @@ -7,6 +8,7 @@
using UniFramework.Event;
using UnityEngine;
using UnityEngine.UI;
using static UnityEngine.Rendering.ReloadAttribute;

public class BundleDemo : MonoBehaviour
{
Expand Down Expand Up @@ -377,6 +379,18 @@ public void CloseRepairWindow()
public string assetName = "";
public GameObject container = null;

/*
* [Load asset and download from specific package]
*
* var packageName = "OtherPackage";
* await AssetPatcher.InitPackage(packageName, true, "127.0.0.1/package", "127.0.0.1/package");
* var package = AssetPatcher.GetPackage(packageName);
* var downloader = AssetPatcher.GetPackageDownloader(package);
* Debug.Log($"Patch Size: {BundleUtility.GetBytesToString((ulong) downloader.TotalDownloadBytes)}");
* await AssetLoaders.LoadAssetAsync<GameObject>(packageName, assetName);
*
*/

public async void PreloadBundle()
{
// if assetName has prefix "res#" will use Resources to load
Expand Down
Loading

0 comments on commit a8039c2

Please sign in to comment.