versionflow autorelease机制优化,下一帧执行卸载
This commit is contained in:
parent
886e884958
commit
712b303858
@ -34,6 +34,8 @@ namespace VersionFlow.Runtime
|
|||||||
|
|
||||||
internal BundleManager(BundleManifest local, BundleManifest remote)
|
internal BundleManager(BundleManifest local, BundleManifest remote)
|
||||||
{
|
{
|
||||||
|
VersionFlowX.BeginCoroutine(AutoReleaseCoroutine());
|
||||||
|
|
||||||
//初始化BundleManager
|
//初始化BundleManager
|
||||||
Stopwatch sw = Stopwatch.StartNew();
|
Stopwatch sw = Stopwatch.StartNew();
|
||||||
|
|
||||||
@ -88,7 +90,24 @@ namespace VersionFlow.Runtime
|
|||||||
VersionFlowX.Log($"创建资源清单耗时:{sw.Elapsed.Milliseconds}ms");
|
VersionFlowX.Log($"创建资源清单耗时:{sw.Elapsed.Milliseconds}ms");
|
||||||
}
|
}
|
||||||
|
|
||||||
internal BundleManager() { }
|
internal BundleManager()
|
||||||
|
{
|
||||||
|
VersionFlowX.BeginCoroutine(AutoReleaseCoroutine());
|
||||||
|
}
|
||||||
|
|
||||||
|
IEnumerator AutoReleaseCoroutine()
|
||||||
|
{
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
if (VersionFlowX.Setting.AutoReleaseBundle && m_unloadDirty)
|
||||||
|
{
|
||||||
|
m_unloadDirty = false;
|
||||||
|
TryUnLoadBundles();
|
||||||
|
}
|
||||||
|
|
||||||
|
yield return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
internal ABEntity GetEntityByAssetPath(string assetPath)
|
internal ABEntity GetEntityByAssetPath(string assetPath)
|
||||||
{
|
{
|
||||||
@ -351,6 +370,7 @@ namespace VersionFlow.Runtime
|
|||||||
return request;
|
return request;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool m_unloadDirty = false;
|
||||||
public void ReleaseAsset<T>(ref T asset) where T : UnityEngine.Object
|
public void ReleaseAsset<T>(ref T asset) where T : UnityEngine.Object
|
||||||
{
|
{
|
||||||
if (!VersionFlowX.Setting.Enable)
|
if (!VersionFlowX.Setting.Enable)
|
||||||
@ -366,8 +386,10 @@ namespace VersionFlow.Runtime
|
|||||||
|
|
||||||
asset = null;
|
asset = null;
|
||||||
|
|
||||||
if (VersionFlowX.Setting.AutoReleaseBundle)
|
if (!m_unloadDirty && VersionFlowX.Setting.AutoReleaseBundle)
|
||||||
TryUnLoadBundles();
|
{
|
||||||
|
m_unloadDirty = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void ReleaseAsset<T>(IList<T> assetList) where T : UnityEngine.Object
|
public void ReleaseAsset<T>(IList<T> assetList) where T : UnityEngine.Object
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user