1
This commit is contained in:
@@ -42,7 +42,7 @@ SpriteAtlasImporter:
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
packingSettings:
|
||||
serializedVersion: 2
|
||||
padding: 4
|
||||
padding: 8
|
||||
blockOffset: 1
|
||||
allowAlphaSplitting: 0
|
||||
enableRotation: 0
|
||||
|
||||
@@ -42,7 +42,7 @@ SpriteAtlasImporter:
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
packingSettings:
|
||||
serializedVersion: 2
|
||||
padding: 4
|
||||
padding: 8
|
||||
blockOffset: 1
|
||||
allowAlphaSplitting: 0
|
||||
enableRotation: 0
|
||||
|
||||
@@ -42,7 +42,7 @@ SpriteAtlasImporter:
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
packingSettings:
|
||||
serializedVersion: 2
|
||||
padding: 4
|
||||
padding: 8
|
||||
blockOffset: 1
|
||||
allowAlphaSplitting: 0
|
||||
enableRotation: 0
|
||||
|
||||
@@ -21,9 +21,18 @@ public class LoadingPanel : MonoBehaviour
|
||||
StartCoroutine(PreloadHomeMainRoutine());
|
||||
}
|
||||
|
||||
/// <summary>预载大厅主面板:等 UIManager 就绪后发起(视频这段时间足够 HomeUIRes 加载完)</summary>
|
||||
/// <summary>先让视频起播,播放过程中再预载大厅主面板(避免大包解压和视频启动抢主线程)</summary>
|
||||
private IEnumerator PreloadHomeMainRoutine()
|
||||
{
|
||||
// 1) 等视频真正开始播放(最多等 5 秒兜底,防止视频未播时死等)
|
||||
float waited = 0f;
|
||||
while (player != null && !player.isPlaying && waited < 5f)
|
||||
{
|
||||
waited += Time.deltaTime;
|
||||
yield return null;
|
||||
}
|
||||
yield return new WaitForSeconds(0.5f); // 让视频先渲染几帧,起播更顺
|
||||
// 2) 播放过程中加载:等 UIManager 就绪后发起预载
|
||||
while (UIManager.Instance == null)
|
||||
yield return null;
|
||||
yield return null; // 等 UIManager 初始化完成(地址表装载)
|
||||
|
||||
@@ -1412,6 +1412,16 @@ public class GameMainPanel_FishBase : GameMainPanel_Base
|
||||
BulletPool.Instance.ClearAll();
|
||||
EffectPool.Instance.ClearAll();
|
||||
_resourcesUnloaded = true;
|
||||
|
||||
// ⭐ 真正回收内存:Addressables 释放包用的是 AssetBundle.Unload(false) 语义 ——
|
||||
// 只是断开引用,已加载的贴图/材质/网格/音频要等 UnloadUnusedAssets 才真正销毁。
|
||||
// iOS 上不调用就会出现"AA 包卸载了但占用内存不降",连续进第二个游戏内存叠加 → jetsam 闪退。
|
||||
// 用 Task 等待(不依赖本面板协程,OnHide 隐藏后也能跑完)。
|
||||
await Task.Delay(50); // 等两帧左右让 Destroy 的延迟销毁生效
|
||||
var unloadOp = Resources.UnloadUnusedAssets();
|
||||
while (!unloadOp.isDone) await Task.Yield();
|
||||
System.GC.Collect();
|
||||
Debug.Log($"[内存] 离房回收完成 | 已分配 {UnityEngine.Profiling.Profiler.GetTotalAllocatedMemoryLong() / 1048576}MB");
|
||||
}
|
||||
|
||||
/// <summary>资源是否已卸载(避免 OnHide 重复卸载)</summary>
|
||||
@@ -1548,6 +1558,15 @@ public class GameMainPanel_FishBase : GameMainPanel_Base
|
||||
SetUnloadProgress(0.6f);
|
||||
await MonsterMoveLine.UnLoadBezier();
|
||||
|
||||
// ⭐ 真正回收内存:AA 包卸载只是断开引用(Unload(false) 语义),贴图/材质/网格/音频
|
||||
// 要等 UnloadUnusedAssets 才真正销毁 —— iOS 上不做这步 = 占用不降,
|
||||
// 连进第二个游戏内存叠加超限 → jetsam 闪退
|
||||
await Task.Delay(50);
|
||||
var leaveUnloadOp = Resources.UnloadUnusedAssets();
|
||||
while (!leaveUnloadOp.isDone) await Task.Yield();
|
||||
System.GC.Collect();
|
||||
Debug.Log($"[内存] 离房回收完成 | 已分配 {UnityEngine.Profiling.Profiler.GetTotalAllocatedMemoryLong() / 1048576}MB");
|
||||
|
||||
// ⭐ 预载回大厅的主面板 prefab:鱼包已卸载腾出内存,加载大厅包不会叠峰值;
|
||||
// 后面等待 socket 的时间足够它加载完,finally 里 ShowAsync(HomeMainPanel) 命中缓存秒开。
|
||||
// (进房时 ReleaseHomeUI 已释放大厅资源,散包后回大厅各子面板首次打开按需单独加载)
|
||||
|
||||
@@ -5830,7 +5830,7 @@ RectTransform:
|
||||
m_LocalEulerAnglesHint: {x: 0, y: -0, z: -0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: 0, y: 10}
|
||||
m_AnchoredPosition: {x: 0, y: 16.9}
|
||||
m_SizeDelta: {x: 100, y: 100}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &2150519324841269184
|
||||
@@ -6244,7 +6244,7 @@ RectTransform:
|
||||
m_LocalEulerAnglesHint: {x: 0, y: -0, z: -0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: -78, y: -14}
|
||||
m_AnchoredPosition: {x: -84.4, y: -14}
|
||||
m_SizeDelta: {x: 33, y: 38}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &1543908191733251521
|
||||
@@ -7574,7 +7574,7 @@ RectTransform:
|
||||
m_LocalEulerAnglesHint: {x: 0, y: -0, z: -0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: 0, y: 10}
|
||||
m_AnchoredPosition: {x: 0, y: 16.7}
|
||||
m_SizeDelta: {x: 100, y: 100}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &9020050173228002626
|
||||
@@ -8717,7 +8717,7 @@ RectTransform:
|
||||
m_LocalEulerAnglesHint: {x: 0, y: -0, z: -0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: -78, y: -14}
|
||||
m_AnchoredPosition: {x: -83.5, y: -14}
|
||||
m_SizeDelta: {x: 33, y: 38}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &2372120819595984433
|
||||
@@ -17102,7 +17102,7 @@ PrefabInstance:
|
||||
- target: {fileID: 224510575461394643, guid: d2f8fbd9109e67448b98f8bc0f5c2e7c,
|
||||
type: 3}
|
||||
propertyPath: m_AnchoredPosition.x
|
||||
value: 12.400003
|
||||
value: 1.800003
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_RemovedGameObjects: []
|
||||
@@ -17713,7 +17713,7 @@ PrefabInstance:
|
||||
- target: {fileID: 224257241236513202, guid: 45613d68bc30eb1428a454bb23ecf900,
|
||||
type: 3}
|
||||
propertyPath: m_AnchoredPosition.x
|
||||
value: 14.200032
|
||||
value: 1.8
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_RemovedGameObjects: []
|
||||
@@ -18539,7 +18539,7 @@ PrefabInstance:
|
||||
- target: {fileID: 224510575461394643, guid: d2f8fbd9109e67448b98f8bc0f5c2e7c,
|
||||
type: 3}
|
||||
propertyPath: m_AnchoredPosition.x
|
||||
value: 14.200032
|
||||
value: 1.8000288
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_RemovedGameObjects: []
|
||||
@@ -19310,7 +19310,7 @@ PrefabInstance:
|
||||
- target: {fileID: 224729652120947055, guid: 574a35f9ac1d30a4baae69fe573af86a,
|
||||
type: 3}
|
||||
propertyPath: m_AnchoredPosition.x
|
||||
value: 12.4
|
||||
value: 1.8
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_RemovedGameObjects: []
|
||||
@@ -20837,7 +20837,7 @@ PrefabInstance:
|
||||
- target: {fileID: 224342906523527382, guid: 3f4820e8b7d63b44f983ebd7dca20d71,
|
||||
type: 3}
|
||||
propertyPath: m_AnchoredPosition.x
|
||||
value: 12.400003
|
||||
value: 1.800003
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 224970498482941826, guid: 3f4820e8b7d63b44f983ebd7dca20d71,
|
||||
type: 3}
|
||||
@@ -21809,7 +21809,7 @@ PrefabInstance:
|
||||
- target: {fileID: 224257241236513202, guid: 45613d68bc30eb1428a454bb23ecf900,
|
||||
type: 3}
|
||||
propertyPath: m_AnchoredPosition.x
|
||||
value: 12.400003
|
||||
value: -0.1
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_RemovedGameObjects: []
|
||||
@@ -22113,7 +22113,7 @@ PrefabInstance:
|
||||
- target: {fileID: 224729652120947055, guid: 574a35f9ac1d30a4baae69fe573af86a,
|
||||
type: 3}
|
||||
propertyPath: m_AnchoredPosition.x
|
||||
value: 14.2
|
||||
value: 1.7999964
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_RemovedGameObjects: []
|
||||
@@ -23066,7 +23066,7 @@ PrefabInstance:
|
||||
- target: {fileID: 224342906523527382, guid: 3f4820e8b7d63b44f983ebd7dca20d71,
|
||||
type: 3}
|
||||
propertyPath: m_AnchoredPosition.x
|
||||
value: 14.200032
|
||||
value: 1.8000288
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 224970498482941826, guid: 3f4820e8b7d63b44f983ebd7dca20d71,
|
||||
type: 3}
|
||||
|
||||
Reference in New Issue
Block a user