Фикс утечки памяти. Первой наверное...
This commit is contained in:
1 parent
f940cbffe0
commit
d861e06caf
1 file changed
+3
-1
@@ -3,6 +3,7 @@ using System.Threading;
|
|||||||
using Code.UI.Panels;
|
using Code.UI.Panels;
|
||||||
using Cysharp.Threading.Tasks;
|
using Cysharp.Threading.Tasks;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
using UnityEngine.AddressableAssets;
|
||||||
using Object = UnityEngine.Object;
|
using Object = UnityEngine.Object;
|
||||||
|
|
||||||
namespace Code.UI
|
namespace Code.UI
|
||||||
@@ -13,6 +14,7 @@ namespace Code.UI
|
|||||||
private IUIFactory _factory;
|
private IUIFactory _factory;
|
||||||
|
|
||||||
public UIElement CurrentPanel { get; private set; }
|
public UIElement CurrentPanel { get; private set; }
|
||||||
|
|
||||||
public LoadingScreen LoadingScreen { get; private set; }
|
public LoadingScreen LoadingScreen { get; private set; }
|
||||||
|
|
||||||
public UIService(IUIFactory factory)
|
public UIService(IUIFactory factory)
|
||||||
@@ -32,7 +34,7 @@ namespace Code.UI
|
|||||||
{
|
{
|
||||||
if (!_canvas) await UniTask.WaitUntil(() => _canvas );
|
if (!_canvas) await UniTask.WaitUntil(() => _canvas );
|
||||||
|
|
||||||
if(CurrentPanel) Object.Destroy(CurrentPanel.gameObject);
|
if(CurrentPanel) Addressables.ReleaseInstance(CurrentPanel.gameObject);//Object.Destroy(CurrentPanel.gameObject);
|
||||||
|
|
||||||
CurrentPanel = await _factory.CreatePanel(_canvas, uiPanel);
|
CurrentPanel = await _factory.CreatePanel(_canvas, uiPanel);
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user