mirror of
https://github.com/tuyoogame/YooAsset.git
synced 2026-05-29 20:48:47 +00:00
Compare commits
2 Commits
4caf733ac6
...
0bde506aec
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0bde506aec | ||
|
|
15005b3d30 |
@@ -43,6 +43,11 @@ namespace YooAsset
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public int BundleLoadingMaxConcurrency = int.MaxValue;
|
public int BundleLoadingMaxConcurrency = int.MaxValue;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 当资源引用计数为零的时候自动释放资源包
|
||||||
|
/// </summary>
|
||||||
|
public bool AutoUnloadBundleWhenUnused = false;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// WebGL平台强制同步加载资源对象
|
/// WebGL平台强制同步加载资源对象
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -23,6 +23,11 @@ namespace YooAsset
|
|||||||
if (IsValidWithWarning == false)
|
if (IsValidWithWarning == false)
|
||||||
return;
|
return;
|
||||||
Provider.ReleaseHandle(this);
|
Provider.ReleaseHandle(this);
|
||||||
|
|
||||||
|
// 主动卸载零引用的资源包
|
||||||
|
if (Provider.RefCount == 0)
|
||||||
|
Provider.TryUnloadBundle();
|
||||||
|
|
||||||
Provider = null;
|
Provider = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -308,6 +308,17 @@ namespace YooAsset
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 尝试卸载资源包
|
||||||
|
/// </summary>
|
||||||
|
public void TryUnloadBundle()
|
||||||
|
{
|
||||||
|
if (_resManager.AutoUnloadBundleWhenUnused)
|
||||||
|
{
|
||||||
|
_resManager.TryUnloadUnusedAsset(MainAssetInfo, 10);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 结束流程
|
/// 结束流程
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ namespace YooAsset
|
|||||||
private int _bundleLoadingMaxConcurrency;
|
private int _bundleLoadingMaxConcurrency;
|
||||||
|
|
||||||
// 开发者配置选项
|
// 开发者配置选项
|
||||||
|
public bool AutoUnloadBundleWhenUnused { private set; get; }
|
||||||
public bool WebGLForceSyncLoadAsset { private set; get; }
|
public bool WebGLForceSyncLoadAsset { private set; get; }
|
||||||
public bool UseWeakReferenceHandle { private set; get; }
|
public bool UseWeakReferenceHandle { private set; get; }
|
||||||
|
|
||||||
@@ -47,6 +48,7 @@ namespace YooAsset
|
|||||||
public void Initialize(InitializeParameters parameters, IBundleQuery bundleServices)
|
public void Initialize(InitializeParameters parameters, IBundleQuery bundleServices)
|
||||||
{
|
{
|
||||||
_bundleLoadingMaxConcurrency = parameters.BundleLoadingMaxConcurrency;
|
_bundleLoadingMaxConcurrency = parameters.BundleLoadingMaxConcurrency;
|
||||||
|
AutoUnloadBundleWhenUnused = parameters.AutoUnloadBundleWhenUnused;
|
||||||
WebGLForceSyncLoadAsset = parameters.WebGLForceSyncLoadAsset;
|
WebGLForceSyncLoadAsset = parameters.WebGLForceSyncLoadAsset;
|
||||||
UseWeakReferenceHandle = parameters.UseWeakReferenceHandle;
|
UseWeakReferenceHandle = parameters.UseWeakReferenceHandle;
|
||||||
_bundleQuery = bundleServices;
|
_bundleQuery = bundleServices;
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: bf6b81dffd4995e42a500ffc0025ec18
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
#if YOO_ASSET_EXPERIMENT
|
#if YOO_MACRO_SUPPORT
|
||||||
namespace YooAsset.Editor
|
namespace YooAsset.Editor
|
||||||
{
|
{
|
||||||
public class MacroDefine
|
public class MacroDefine
|
||||||
@@ -5,7 +5,7 @@ using System.Text;
|
|||||||
using System.Xml;
|
using System.Xml;
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
|
|
||||||
#if YOO_ASSET_EXPERIMENT
|
#if YOO_MACRO_SUPPORT
|
||||||
namespace YooAsset.Editor
|
namespace YooAsset.Editor
|
||||||
{
|
{
|
||||||
[InitializeOnLoad]
|
[InitializeOnLoad]
|
||||||
@@ -6,7 +6,7 @@ using System.Xml;
|
|||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
#if YOO_ASSET_EXPERIMENT
|
#if YOO_MACRO_SUPPORT
|
||||||
namespace YooAsset.Editor.Experiment
|
namespace YooAsset.Editor.Experiment
|
||||||
{
|
{
|
||||||
[InitializeOnLoad]
|
[InitializeOnLoad]
|
||||||
Reference in New Issue
Block a user