Skip to content

Commit 00921c3

Browse files
committed
updated to v2.12.5
1 parent bb7272f commit 00921c3

File tree

7 files changed

+61
-43
lines changed

7 files changed

+61
-43
lines changed

Assets/OxGFrame/AssetLoader/Scripts/Runtime/Bundle/PatchLauncher.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ internal class PatchLauncher : MonoBehaviour
2626

2727
[Separator("Download Options")]
2828
[Tooltip("* [WebRequest] supports dynamic query built-in files (Some memory will be used, but will be released at next GC).\n\n* [BuiltinFileManifest] query built-in files from manifest (setup at build-time or manual export).\n\n* [BuiltinFileManifest with CRC] query built-in files and check CRC from manifest (setup at build-time or manual export).")]
29-
public BundleConfig.BuiltinQueryMode builtinQueryMode = BundleConfig.BuiltinQueryMode.WebRequest;
29+
public BundleConfig.BuiltinQueryMode builtinQueryMode = BundleConfig.BuiltinQueryMode.BuiltinFileManifest;
3030
public int maxConcurrencyDownloadCount = BundleConfig.maxConcurrencyDownloadCount;
3131
public int failedRetryCount = BundleConfig.failedRetryCount;
3232
[Tooltip("If file size >= [BreakpointFileSizeThreshold] that file will enable breakpoint mechanism (for all downloaders).")]

Assets/OxGFrame/AssetLoader/Scripts/Runtime/Bundle/YooAssets/StreamingAssetsHelper/StreamingAssetsHelper.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,11 +152,11 @@ internal class PreprocessBuild : UnityEditor.Build.IPreprocessBuildWithReport
152152
/// </summary>
153153
public void OnPreprocessBuild(UnityEditor.Build.Reporting.BuildReport report)
154154
{
155-
ExportBuiltinFileManifest();
155+
_ExportBuiltinFileManifest();
156156
}
157157

158158
[UnityEditor.MenuItem("OxGFrame/AssetLoader/" + "Export Built-in File Manifest (BuiltinFileManifest.asset)", false, 879)]
159-
private static void ExportBuiltinFileManifest()
159+
private static void _ExportBuiltinFileManifest()
160160
{
161161
string saveFilePath = Path.Combine(_resourcesPath, _MANIFEST_FILE_NAME + _MANIFEST_FILE_EXTENSION);
162162
string saveFileMetaPath = Path.Combine(_resourcesPath, _MANIFEST_FILE_NAME + _MANIFEST_FILE_EXTENSION + _META_FILE_EXTENSION);

Assets/OxGFrame/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# CHANGELOG
22

3+
## [2.12.5] - 2025-01-02
4+
- Modified the default value of builtinQueryMode in PatchLauncher to BuiltinFileManifest. WebRequest will be deprecated in the future, so it is recommended to switch to BuiltinFileManifest.
5+
- Optimized to reduce the FrameManager Update GC issue in CoreFrame.
6+
- Optimized to accelerate the garbage collection efficiency of the Collector dictionary in FrameBase.
7+
38
## [2.12.4] - 2024-12-30
49
- Fixed the issue with the condition triggering PackageEvents.PatchInitPatchModeFailed.SendEventMessage in PackageFsmStates.
510

Assets/OxGFrame/CoreFrame/Scripts/Runtime/Core/CPFrame/CPBase.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ private void OnDisable()
5757
private void OnDestroy()
5858
{
5959
this.OnRelease();
60+
this.Dispose();
6061
AssetLoaders.UnloadAsset(this.assetName);
6162
}
6263

Assets/OxGFrame/CoreFrame/Scripts/Runtime/Core/Implement/FrameBase.cs

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using Cysharp.Threading.Tasks;
22
using MyBox;
3+
using System;
34
using System.Collections.Generic;
45
using UnityEngine;
56

@@ -14,7 +15,7 @@ namespace OxGFrame.CoreFrame
1415
public abstract class FrameBase : MonoBehaviour
1516
{
1617
#region 綁定物件的收集器
17-
public class Collector
18+
public class Collector : IDisposable
1819
{
1920
#region 依照綁定類型建立緩存容器
2021
// 用於存放綁定物件的緩存 (GameObject)
@@ -99,6 +100,15 @@ public TComponent[] GetNodeComponents<TComponent>(string bindName)
99100

100101
return components;
101102
}
103+
104+
/// <summary>
105+
/// Release
106+
/// </summary>
107+
public void Dispose()
108+
{
109+
this._nodes.Clear();
110+
this._nodes = null;
111+
}
102112
#endregion
103113
}
104114
#endregion
@@ -259,6 +269,15 @@ protected virtual void OnHide() { }
259269
/// </summary>
260270
public virtual void OnRelease() { }
261271

272+
/// <summary>
273+
/// 釋放引用
274+
/// </summary>
275+
internal virtual void Dispose()
276+
{
277+
this.collector.Dispose();
278+
this.collector = null;
279+
}
280+
262281
/// <summary>
263282
/// 調用關閉自己
264283
/// </summary>

Assets/OxGFrame/CoreFrame/Scripts/Runtime/Core/Implement/FrameManager.cs

Lines changed: 31 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -133,65 +133,57 @@ public U Pop()
133133
private void Update()
134134
{
135135
if (!this.enabledUpdate) return;
136+
_dt = ignoreTimeScale ? Time.unscaledDeltaTime : Time.deltaTime;
136137
this.DriveUpdates(UpdateType.Update);
137138
}
138139

139140
private void FixedUpdate()
140141
{
141142
if (!this.enabledFixedUpdate) return;
143+
_fdt = ignoreTimeScale ? Time.fixedUnscaledDeltaTime : Time.fixedDeltaTime;
142144
this.DriveUpdates(UpdateType.FixedUpdate);
143145
}
144146

145147
private void LateUpdate()
146148
{
147149
if (!this.enabledLateUpdate) return;
150+
_dt = ignoreTimeScale ? Time.unscaledDeltaTime : Time.deltaTime;
148151
this.DriveUpdates(UpdateType.LateUpdate);
149152
}
150153

151154
public void DriveUpdates(UpdateType updateType)
152155
{
153-
if (this._dictAllCache.Count > 0)
156+
if (this._dictAllCache.Count == 0)
157+
return;
158+
159+
int fStackCount = this._dictAllCache.Count;
160+
foreach (var fStack in this._dictAllCache.Values)
154161
{
155-
var fStacks = this._dictAllCache.Values.ToArray();
156-
foreach (var fStack in fStacks)
157-
{
158-
// 判斷陣列長度是否有改變, 有改變表示陣列元素有更動
159-
if (this._dictAllCache.Count != fStacks.Length) break;
162+
// 判斷陣列長度是否有改變, 有改變表示陣列元素有更動
163+
if (this._dictAllCache.Count != fStackCount)
164+
break;
160165

161-
var fBases = fStack.cache.ToArray();
162-
foreach (var fBase in fBases)
163-
{
164-
if (fStack.Count() != fBases.Length) break;
166+
int fBaseCount = fStack.Count();
167+
foreach (var fBase in fStack.cache)
168+
{
169+
if (fStack.Count() != fBaseCount)
170+
break;
165171

166-
// 僅刷新激活的物件
167-
if (this.CheckIsShowing(fBase))
168-
{
169-
switch (updateType)
170-
{
171-
case UpdateType.Update:
172-
case UpdateType.LateUpdate:
173-
if (!this.ignoreTimeScale) _dt = Time.deltaTime;
174-
else _dt = Time.unscaledDeltaTime;
175-
break;
176-
case UpdateType.FixedUpdate:
177-
if (!this.ignoreTimeScale) _fdt = Time.fixedDeltaTime;
178-
else _fdt = Time.fixedUnscaledDeltaTime;
179-
break;
180-
}
172+
// 僅刷新激活的物件
173+
if (!this.CheckIsShowing(fBase))
174+
continue;
181175

182-
switch (updateType)
183-
{
184-
case UpdateType.Update:
185-
fBase.HandleUpdate(_dt);
186-
break;
187-
case UpdateType.FixedUpdate:
188-
fBase.HandleFixedUpdate(_fdt);
189-
break;
190-
case UpdateType.LateUpdate:
191-
fBase.HandleLateUpdate(_dt);
192-
break;
193-
}
194-
}
176+
switch (updateType)
177+
{
178+
case UpdateType.Update:
179+
fBase.HandleUpdate(_dt);
180+
break;
181+
case UpdateType.FixedUpdate:
182+
fBase.HandleFixedUpdate(_fdt);
183+
break;
184+
case UpdateType.LateUpdate:
185+
fBase.HandleLateUpdate(_dt);
186+
break;
195187
}
196188
}
197189
}
@@ -609,6 +601,7 @@ protected virtual void Destroy(T fBase, string assetName)
609601
{
610602
// 調用釋放接口
611603
fBase.OnRelease();
604+
fBase.Dispose();
612605

613606
// 刪除物件
614607
if (!fBase.gameObject.IsDestroyed()) Destroy(fBase.gameObject);

Assets/OxGFrame/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "com.michaelo.oxgframe",
33
"displayName": "OxGFrame",
44
"description": "The OxGFrame is a framework based on Unity for accelerating game development. Supports multi-platform Win, OSX, Android, iOS, WebGL.",
5-
"version": "2.12.4",
5+
"version": "2.12.5",
66
"unity": "2021.3",
77
"license": "MIT",
88
"samples": [

0 commit comments

Comments
 (0)